I'm beginner in ogre3D and I'm build mi first program in Ogre3D, but when I try to compile the program I get this error:
In function `main':
test.cpp:(.text+0x14): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x30): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
test.cpp:(.text+0x40): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x5c): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
test.cpp:(.text+0x6c): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x88): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
And Continue the fix
gcc test.cpp -o test.o test
And my file test is this:
#include <Ogre.h>
using namespace Ogre;
int main()
{
Root* root= new Root();
if( !root->restoreConfig() )
{
root->showConfigDialog();
root->saveConfig();
}
return 0;
}
How to fix my problem?
I'm use Debian Wheezy.
The Version Ogre3D: 1.8
Thanks for your answers.
This is a linker error.
Use pkg-config --libs
to retrieve the correct linker options
g++ -o test test.cpp -Wall $(pkg-config --cflags OGRE) $(pkg-config --libs OGRE) -lboost_system
If you have installed OGRE in a nonstandard location (say /opt/ogre
), you may need to call pkg-config with the PKG_CONFIG_PATH
environment variable set:
PKG_CONFIG_PATH=/opt/ogre/lib/pkgconfig pkg-config --libs OGRE