well :
object.h:
class object;
object.cpp
#include "object.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace sf;
using namespace std;
class object
{
public:
Image Bild;
Sprite Abbild;
float x_pos;
float y_pos;
float height;
float width;
bool collides(object &partner);
void LoadFromFile(const std::string& Filename);
};
void object::LoadFromFile(const std::string& Filename)
{
Bild.LoadFromFile(Filename);
}
main.cpp
#include <iostream>
#include "object.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace std;
using namespace sf;
/*class object
{
public:
Image Bild;
Sprite Abbild;
float x_pos;
float y_pos;
float height;
float width;
bool collides(object &partner);
void LoadFromFile(const std::string& Filename);
};
void object::LoadFromFile(const std::string& Filename)
{
Bild.LoadFromFile(Filename);
}
*/
int main()
{
object x;
RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
x.LoadFromFile("h.jpg");
return 0;
}
returns : C:\Programme\CodeBlocks\MEINS\Object\main.cpp|35|error: aggregate `object x' has incomplete type and cannot be defined|
when i dont split the data and write it all in main.cpp it worksd fine, wqhy?