0
cygwin에서 g ++로 큰 코드베이스를 컴파일하려고합니다. 컴파일이 실패하고 나는 다음과 같은 독립적 인 테스트 케이스에 문제를 감소 :cygwin에서 g ++로 정적 컴파일에서 다중 정의 오류가 발생했습니다.
이파일 MAIN.CPP :
#include <stdexcept>
int main() {
std::logic_error One("One");
std::logic_error Two(One);
return 0;
}
컴파일 명령 및 결과 :
이$ g++ -std=c++11 -static main.cpp
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libstdc++.a(cow-stdexcept.o): In function `std::logic_error::logic_error(std::logic_error const&)':
/usr/src/debug/gcc-6.4.0-1/libstdc++-v3/src/c++11/cow-stdexcept.cc:59: multiple definition of `std::logic_error::logic_error(std::logic_error const&)'
/tmp/ccCSKFES.o:main.cpp:(.text$_ZNSt11logic_errorC1ERKS_[_ZNSt11logic_errorC1ERKS_]+0x0): first defined here
collect2: error: ld returned 1 exit status
파일은 컴파일 CentOS의 g ++ 5.3.1 및 6.3.1 링크 Cygwin에서 g ++ 6.3.0 및 6.4.0으로 링크하지 못합니다. 플래그 "-static"을 생략하면 항상 컴파일되고 링크됩니다. Cygwin에서 g ++의 버그입니까? 아니면 코드에 이상이 있습니까?