Whenever I compile my code, g++ returns this error message (this is just a segement. The rest is more of the same):
text.cpp:(.text+0x2b82): undefined reference to `parser(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccSFOyBc.o:text.cpp:(.text+0x2c3c): more undefined references to `parser(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' follow
/tmp/ccSFOyBc.o: In function `main':
text.cpp:(.text+0x2f02): undefined reference to `contains(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
text.cpp:(.text+0x30d2): undefined reference to `contains(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
Parser and contains are both functions I created that exist in the program. I heard this issue occurs when you do not link libraries or forgetting to link multiple files together, but I am only using one file (text.cpp) and have one library (-lncurses), and these errors occur with functions I have defined in the program.
I compile with g++ text.cpp -lncurses
. I am using Fedora Linux 24 with the latest g++.
Any idea what this means?
Aucun commentaire:
Enregistrer un commentaire