Hi, I've a namespace odfaeg and sub namespaces g2d and g3d :
But when I want to use the classes of the namespace odfaeg::g3d which have the same name than those one contained in the namespace odfaeg::g2d, the compialtor gives me undefined reference errors.
int main() {
odfaeg::g3d::RenderWindow window(sf::VideoMode(800, 600), "TestODFAEG");
sf::Texture *text;
text->loadFromFile("tilesets/herbe.png");
odfaeg::g3d::Tile *tile = new odfaeg::g3d::Tile(text, odfaeg::Vec2f(0, 0), odfaeg::Vec2f(100, 50), sf::IntRect(0, 0, 100, 50),0);
// BoundingRectangle rect (0, 0, 1000, 1000);
//generate_floor(tiles,rect);
while(window.isOpen()) {
window.clear(sf::Color(0, 0, 0));
window.display();
sf::Event event;
while(window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
}
}
Tile inherit from entity and entity inherits from transformable and drawable, and I've putting all the source code of all those classe in this namespaces :
namespace odfaeg {
namespace g3d {
}
}
For the 3D classes and
namespace odfaeg {
namespace g2d {
}
}
For the 2D classes.
To avoid to have to prefix the classes like this : G2DEntity and G3DEntity.
But it seems it doesn't work and it always look in the g2d namespace even if I define the subnamespace without using the using keywork.
int main() {
odfaeg::g3d::RenderWindow window(sf::VideoMode(800, 600), "TestODFAEG");
sf::Texture *text;
text->loadFromFile("tilesets/herbe.png");
odfaeg::g3d::Tile *tile = new odfaeg::g3d::Tile(text, odfaeg::Vec2f(0, 0), odfaeg::Vec2f(100, 50), sf::IntRect(0, 0, 100, 50),0);
// BoundingRectangle rect (0, 0, 1000, 1000);
//generate_floor(tiles,rect);
while(window.isOpen()) {
window.clear(sf::Color(0, 0, 0));
window.display();
sf::Event event;
while(window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
}
}
D:\Projets\Projets-c++\Test3DODFAEG\main.cpp|34|undefined reference to `odfaeg::g3d::Tile::Tile(sf::Texture const*, odfaeg::Vec2f, odfaeg::Vec2f, sf::Rect<int>, int, odfaeg::g3d::Entity*)'|
I don't know why but the compilator go in the namespace odfaeg::g2d and not in the namespace odfaeg::g3d.
I think I'll get rid of the subnamespace g2d by putting all the 2d classes in the namespace odfaeg and let the 3d classes in the namespace odfaeg::g3d....
But it really suck. :/