C++ erreurs lors de la compilation
Je suis en train de compiler un jeu, mais l'obtention de 100+ erreurs comme:
C:\Users\AppData\Local\Temp\cctQCagR.o: In function `load_image(std::string)':
main.cpp:(.text+0x4bd4): undefined reference to `std::string::c_str() const'
C:\Users\Bill\AppData\Local\Temp\cctQCagR.o: In function `createShip(float, float)':
main.cpp:(.text+0x4da4): undefined reference to `std::allocator<char>::allocator()'
main.cpp:(.text+0x4dbc): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> cons
t&)'
main.cpp:(.text+0x4de4): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::~basic_string()'
main.cpp:(.text+0x4e04): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::~basic_string()'
main.cpp:(.text+0x4e1c): undefined reference to `std::allocator<char>::~allocator()'
main.cpp:(.text+0x4e28): undefined reference to `std::allocator<char>::allocator()'
main.cpp:(.text+0x4e40): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> cons
t&)'
main.cpp:(.text+0x4e60): undefined reference to `std::allocator<char>::~allocator()'
main.cpp:(.text+0x4e70): undefined reference to `__cxa_end_cleanup'
main.cpp:(.text+0x4e98): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::~basic_string()'
main.cpp:(.text+0x4eb8): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::~basic_string()'
main.cpp:(.text+0x4ed0): undefined reference to `std::allocator<char>::~allocator()'
main.cpp:(.text+0x4ef4): undefined reference to `std::allocator<char>::~allocator()'
main.cpp:(.text+0x4f04): undefined reference to `__cxa_end_cleanup'
C:\Users\Bill\AppData\Local\Temp\cctQCagR.o: In function `load_files()':
main.cpp:(.text+0x5164): undefined reference to `std::allocator<char>::allocator()'
main.cpp:(.text+0x517c): undefined reference to `std::basic_string<char, std::char_tra
its<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> cons
t&)'
- Vous reliant à l'encontre de votre C++ de la bibliothèque standard, à droite?
- Vous obtenez des erreurs d'édition de liens. Sont toutes les bibliothèques concernées à l'aide de la même version du même compilateur, en utilisant les mêmes paramètres d'exécution?
- Pouvez-vous coller la commande que vous utilisez pour compiler?
- Aide: arm-none-linux-gnueabi-gcc ............ pour compiler
- Vous avez besoin d'afficher plus de contexte à votre question. Quels sont, par exemple, est contenue dans Particle_Engine.h (après le code), ou est-il un tiers de l'en-tête? Aussi, vous devriez nous dire la totalité de la commande que vous utilisez lors de la compilation.
- Il ne faut pas changer une question à quelque chose de totalement autre chose. Accepter une réponse appropriée à votre question de départ et le début d'une nouvelle question avec votre nouveau des problèmes. Je suis allé et a fait un retour en arrière à l'original de votre question, de sorte que les réponses encore un sens.
Vous devez vous connecter pour publier un commentaire.
Je crois que vous êtes en essayant de compiler main.cpp avec gcc au lieu de g++.
Si vous générez le code ci-dessus, extrait avec gcc que vous obtenez des erreurs que vous mentionnez.
Si vous utiliser g++ de construire ok, c'est logique, puisque g++ sera assurez-vous que tous les trucs de mettre ensemble quand construire C++.
Vous devez relier votre binaire avec libstdc++. Vous devez explicitement spécifier dans la ligne de commande si vous utilisez gcc:
Si à l'aide de g++, libstdc++ sera lié par défaut: