linux上的Ogre3D错误

linux上的Ogre3D错误,linux,ogre3d,Linux,Ogre3d,我是ogre3D的初学者,我正在ogre3D中构建mi first程序,但当我尝试编译程序时,我遇到以下错误: 函数“main”中的: test.cpp:(.text+0x14):对“std::allocator::allocator()”的未定义引用 test.cpp:(.text+0x30):对'std::basic_string::basic_string(char const*)的未定义引用, std::分配器常数&)' test.cpp:(.text+0x40):对“std::allo

我是ogre3D的初学者,我正在ogre3D中构建mi first程序,但当我尝试编译程序时,我遇到以下错误:

函数“main”中的
:
test.cpp:(.text+0x14):对“std::allocator::allocator()”的未定义引用
test.cpp:(.text+0x30):对'std::basic_string::basic_string(char const*)的未定义引用,
std::分配器常数&)'
test.cpp:(.text+0x40):对“std::allocator::allocator()”的未定义引用
test.cpp:(.text+0x5c):对'std::basic_string::basic_string(char const*)的未定义引用,
std::分配器常数&)'
test.cpp:(.text+0x6c):对“std::allocator::allocator()”的未定义引用
test.cpp:(.text+0x88):对'std::basic_string::basic_string(char const*)的未定义引用,
std::分配器常数&)'
然后继续修复

  • 我手动编译程序:
  • gcc test.cpp-o test.o test
    
    我的文件测试是:

    #包括
    使用名称空间Ogre;
    int main()
    {
    根*根=新根();
    如果(!root->restoreConfig())
    {
    root->showConfigDialog();
    root->saveConfig();
    }
    返回0;
    }
    
    如何解决我的问题

    我在喘息

    Ogre3D版本:1.8

    感谢您的回答。

    这是链接器错误。 使用
    pkg config--libs
    检索正确的链接器选项

    g++ -o test test.cpp -Wall $(pkg-config --cflags OGRE) $(pkg-config --libs OGRE) -lboost_system
    
    如果您已将OGRE安装在非标准位置(例如
    /opt/OGRE
    ),则可能需要使用
    pkg\u config\u路径
    环境变量集调用pkg config:

    PKG_CONFIG_PATH=/opt/ogre/lib/pkgconfig pkg-config --libs OGRE
    
    这是一个链接器错误。 使用
    pkg config--libs
    检索正确的链接器选项

    g++ -o test test.cpp -Wall $(pkg-config --cflags OGRE) $(pkg-config --libs OGRE) -lboost_system
    
    如果您已将OGRE安装在非标准位置(例如
    /opt/OGRE
    ),则可能需要使用
    pkg\u config\u路径
    环境变量集调用pkg config:

    PKG_CONFIG_PATH=/opt/ogre/lib/pkgconfig pkg-config --libs OGRE
    

    这是一个链接器错误,但不是到Ogre3d,而是到STL(标准模板库)。原因是您使用的是gcc,而您应该使用g++。然而,令我惊讶的是,你没有得到Ogre的链接器错误,解决方法就像Thomas建议的那样(尽管他在他的例子中也使用了“g++)。

    这是一个链接器错误,但不是Ogre3d,而是STL(标准模板库)。原因是您使用的是gcc,而您应该使用g++。然而,令我惊讶的是,你也没有在Ogre上发现链接器错误,解决方法就像Thomas建议的那样(尽管他在他的例子中也使用了“g++)。

    你也可以在freenode irc网络上的#ogre3d中问这些类型的问题。你也可以在freenode irc网络上的#ogre3d中问这些类型的问题。