2017-03-02 4 views
3

나는 코딩하는 법을 배우고 있습니다.clang ++ (버전 5) 및 LNK4217 경고

나는 창에서 Visual Studio 14

를 사용하여 10 시스템을 연타 버전 5를 설치 한 나는 작동하는지 테스트하는 안녕하세요 세계 CPP 파일을 만들었습니다.

샘플 코드

#include <iostream> 
using namespace std; 

int main() 
{ 
    cout << "Hello World!\n"; 
    int rip{1}; 
    int dal{4}; 

    int kane = rip + dal; 

    cout << kane; 
    return 0; 
} 

명령

clang++ -o .\bin\testing.exe test.cpp 

연타 컴파일 않고 내가 예상대로 실행 않는 실행 파일을 얻을. 그러나 나는이 메시지를 받는다.

test-3e53b3.o : warning LNK4217: locally defined symbol ___std_terminate imported in function "int `public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)'::`1'::dtor$5" ([email protected][email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected]@4HA) 
test-3e53b3.o : warning LNK4217: locally defined symbol [email protected] imported in function "public: void __thiscall std::ios_base::clear(int,bool)" ([email protected][email protected]@@[email protected]) 

온라인으로 검색 한 결과 비슷한 문제가있을 수 있지만 동일하지는 않습니다.

나는 너에게 이걸로 간단하다고 생각하지만, 나는 잃어버린 여러 IDES와 GCC를 사용했고이 코드는이 경고를 만들어 내지 못했다.

답변

11

-Xclang -flto-visibility-public-std을 컴파일러 옵션에 추가하십시오.

clang++ -Xclang -flto-visibility-public-std -o test.exe test.cpp

편집 : 대신

또는 사용 그 소리-CL :

clang-cl -o test.exe test.cpp

+6

작동하지만, 왜 그렇게처럼

? clang-cl은 무엇이며 옵션은 무엇을합니까? – bugybunny