2012-09-09 1 views
1

에 Ogre3D :오류가 나는 ogre3D에서 초보자 그리고 난 Ogre3D에서 마일 첫 번째 프로그램을 구축,하지만 난이 프로그램을 컴파일하려고하면이 오류 얻을 리눅스

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&)' 

을 그리고 수정을 계속

gcc test.cpp -o test.o test 

을 그리고 내 파일 테스트는 이것이다 :

  1. 나는 수동으로 프로그램을 컴파일

    #include <Ogre.h> 
    
    using namespace Ogre; 
    
    int main() 
    { 
    Root* root= new Root(); 
    
    if(!root->restoreConfig()) 
    { 
        root->showConfigDialog(); 
        root->saveConfig(); 
    } 
    return 0; 
    } 
    

    내 문제를 해결하는 방법?

    데비안 Wheezy를 사용하고 있습니다.

    버전 Ogre3D : 1.8

    답장을 보내 주셔서 감사합니다.

답변

1

이것은 링커 오류입니다.

PKG_CONFIG_PATH=/opt/ogre/lib/pkgconfig pkg-config --libs OGRE 
: 당신이 ( /opt/ogre 말) 비표준 위치에 괴물을 설치 한 경우 사용 pkg-config --libs, 당신은 PKG_CONFIG_PATH 환경 변수 세트 PKG-설정을 문의해야 올바른 링커 옵션

g++ -o test test.cpp -Wall $(pkg-config --cflags OGRE) $(pkg-config --libs OGRE) -lboost_system 

를 검색

+0

감사합니다. 작동합니다. –

0

이것은 링커 오류이지만 Ogre3d가 아니라 STL (Standard Template Library)입니다. 그 이유는 gcc을 사용할 때 g ++을 사용해야 할 때입니다. 그러나 오우거에게 링커 오류가 발생하지 않는다는 사실에 놀랐습니다. 그 해결책은 토마스가 제안한 것입니다 (비록 그의 예제에서 "g ++"를 사용하기는하지만).

+0

freenode irc 네트워크의 # ogre3d에서 이러한 유형의 질문을 할 수도 있습니다. –