0

I started to use Tup for my C++ projects. My current one is a game, divided in 3 parts :

  • The first is the main directory "osumax" ;
  • The second is my game framework "osumax/Libraries/ns_framework" ;
  • And the last is an API for the game data "osumax/Libraries/osumax_shared" ;

Currently, there are nothing in the osumax_shared, since I'm working on the framework.

ns_framework and osumax_shared are dynamic libraries (I'm under Linux, so there are .so files).

The libns_framework.so builds without even a warning, but when the build of the main executable starts I've got a plenty of errors, and only undefined references. Some are from ns_framework, which I can understand, but I'm also using TinyXML2 (installed with apt-get), and there are many undefined references from this library.

It's the complete output :

[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.130s] Reading in new environment variables...
[ tup ] [0.131s] Parsing Tupfiles...
 1) [0.001s] build-linux-x86_64-debug
 [ ] 100%
[ tup ] [0.136s] No files to delete.                                                                                                                           
[ tup ] [0.136s] Generating .gitignore files...
[ tup ] [0.265s] Executing Commands...
 1) [0.466s] build-linux-x86_64-debug: Compiling Sources/Main.cpp...                                                                                           
* 2) build-linux-x86_64-debug: g++ -L./Libraries/ -lns_framework -ltinyxml2 -lsfml-system -lsfml-window -lsfml-graphics -o ./osumax Objects/Main.o             
Objects/Main.o: In function `main':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:35: undefined reference to `tinyxml2::XMLDocument::XMLDocument(bool)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:36: undefined reference to `ns::C_XmlObject::save(tinyxml2::XMLDocument&) const'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:36: undefined reference to `tinyxml2::XMLNode::InsertEndChild(tinyxml2::XMLNode*)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:37: undefined reference to `tinyxml2::XMLDocument::Print(tinyxml2::XMLPrinter*)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:35: undefined reference to `tinyxml2::XMLDocument::~XMLDocument()'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:35: undefined reference to `tinyxml2::XMLDocument::~XMLDocument()'
Objects/Main.o: In function `tinyxml2::XMLNode::FirstChildElement(char const*)':
/usr/include/tinyxml2.h:473: undefined reference to `tinyxml2::XMLNode::FirstChildElement(char const*) const'
Objects/Main.o: In function `tinyxml2::XMLElement::SetAttribute(char const*, char const*)':
/usr/include/tinyxml2.h:900: undefined reference to `tinyxml2::XMLElement::FindOrCreateAttribute(char const*)'
/usr/include/tinyxml2.h:900: undefined reference to `tinyxml2::XMLAttribute::SetAttribute(char const*)'
Objects/Main.o: In function `ns::C_XmlAbstractField::~C_XmlAbstractField()':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:39: undefined reference to `vtable for ns::C_XmlAbstractField'
Objects/Main.o: In function `ns::C_XmlObject::C_XmlObject(std::string)':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlObject.hpp:39: undefined reference to `vtable for ns::C_XmlObject'
Objects/Main.o: In function `Test::Test()':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:13: undefined reference to `ns::C_XmlObject::~C_XmlObject()'
Objects/Main.o: In function `ns::C_XmlAbstractField::C_XmlAbstractField()':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:17: undefined reference to `vtable for ns::C_XmlAbstractField'
Objects/Main.o:(.data.rel.ro._ZTV4Test[_ZTV4Test]+0x20): undefined reference to `ns::C_XmlObject::load(tinyxml2::XMLDocument const&, tinyxml2::XMLElement const*)'
Objects/Main.o:(.data.rel.ro._ZTV4Test[_ZTV4Test]+0x28): undefined reference to `ns::C_XmlObject::save(tinyxml2::XMLDocument&) const'
Objects/Main.o: In function `Test::~Test()':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Sources/Main.cpp:9: undefined reference to `ns::C_XmlObject::~C_XmlObject()'
Objects/Main.o:(.data.rel.ro._ZTIN2ns10C_XmlFieldIiEE[_ZTIN2ns10C_XmlFieldIiEE]+0x18): undefined reference to `typeinfo for ns::C_XmlAbstractField'
Objects/Main.o:(.data.rel.ro._ZTI4Test[_ZTI4Test]+0x10): undefined reference to `typeinfo for ns::C_XmlObject'
Objects/Main.o: In function `ns::C_XmlField<int>::write(tinyxml2::XMLDocument&, tinyxml2::XMLElement*) const':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:221: undefined reference to `tinyxml2::XMLDocument::NewElement(char const*)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:223: undefined reference to `tinyxml2::XMLDocument::NewText(char const*)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:223: undefined reference to `tinyxml2::XMLNode::InsertFirstChild(tinyxml2::XMLNode*)'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:225: undefined reference to `tinyxml2::XMLNode::InsertEndChild(tinyxml2::XMLNode*)'
Objects/Main.o: In function `ns::C_XmlField<int>::read(tinyxml2::XMLElement const*)':
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:243: undefined reference to `tinyxml2::XMLNode::FirstChildElement(char const*) const'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:250: undefined reference to `tinyxml2::XMLElement::GetText() const'
/home/linkpy/Documents/Devel/C++/osumax/osumax/.tup/mnt/@tupjob-596/home/linkpy/Documents/Devel/C++/osumax/osumax/build-linux-x86_64-debug/Libraries/ns_framework/Headers/ns/xml/C_XmlField.hpp:257: undefined reference to `tinyxml2::XMLElement::Attribute(char const*, char const*) const'
collect2: error: ld returned 1 exit status
 *** tup errors ***
 *** Command ID=598 failed with return value 1
tup error: Expected to write to file 'osumax' from cmd 598 but didn't
 *** Additionally, command 598 failed to process input dependencies. These should probably be fixed before addressing the command failure.
 [   ]  99%
 *** tup: 1 job failed.

The linking command is this one :

g++ -L./Libraries/ -lns_framework -ltinyxml2 -lsfml-system -lsfml-window -lsfml-graphics -o ./osumax Objects/Main.o

I give you here the two Tup file (sorry for the french comments) :

So, is these errors come from the Tup build system, or from me ?

I don't really understand where is my error, or if I done something wrong is the tup configuration.

Thanks for your help !

0 Answers0