나는 std :: variant를 가져 오는 동안 문제가있었습니다. 여기에 비슷한 불만에 직면하는 QtCreator 프로젝트에서 일하기 :-std = C++ 17이 컴파일러 출력에있을 때 -std ++ 17 플래그를 사용하여 std :: variant에 대해 C++ 17 지원을 사용하도록 컴파일러에 요청합니다.
Can't use c++17 features using g++ 7.2 in QtCreator
을 나는이 문제를 해결하고 행복하게 더 이상의 문제에 약간의 시간이 프로젝트에 참여하고있다. 이것은 우분투 14.04에서 실행되었고, GCC 7.2.0으로 빌드되었고, clang 5.0에서도 빌드되었습니다.
2 일 전 최신 QtCreator를 설치하고 모든 도구를 다시 설치했으며 (gcc 7.2.0 및 clang 5.0) 내 프로젝트를 가져 와서 빌드를 시도했습니다. 빌드 진술, 실패
QMAKE_CXXFLAGS += -std=c++17
그리고 컴파일러 출력의 문구 "-std = C++ 17"에서 볼 수 있습니다 내 프로젝트 파일에서
/usr/include/c++/7.2.0/bits/c++17_warning.h:32: error: This file requires compiler and library support for the ISO C++ 2017 standard. This support must be enabled with the -std=c++17 or -std=gnu++17 compiler options.
을, 나는 이미이 있습니다 . 다음은 첫 번째 오류까지의 전체 컴파일러 출력입니다.
15:08:37: Running steps for project AIRadioQt...
15:08:37: Skipping disabled step qmake.
15:08:37: Starting: "/usr/bin/make"
/home/pete/Programming/Qt/5.10.0/gcc_64/bin/qmake -o Makefile ../AIRadioQt/AIRadioQt.pro -spec linux-clang CONFIG+=debug CONFIG+=qml_debug
clang++ -c -pipe -std=c++17 -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_DATAVISUALIZATION_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AIRadioQt -I. -I../src -I../src/AIBase -I../src/Maths -I../src/Random -isystem /usr/local/include/csound -I../../../../Programming/Qt/5.10.0/gcc_64/include -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtDataVisualization -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtWidgets -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtGui -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I../../../../Programming/Qt/5.10.0/gcc_64/mkspecs/linux-clang -o main.o ../AIRadioQt/main.cpp
In file included from ../AIRadioQt/main.cpp:1:
In file included from ../AIRadioQt/stdafx.h:9:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/variant:35:
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/c++17_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2017 standard. This support must be enabled with the -std=c++17 or -std=gnu++17 compiler options.
#error This file requires compiler and library support \
^
따라서 위에서 볼 수 있듯이 -std = C++ 17 플래그가 설정됩니다. 깃발 순서에 문제가 있습니까?
다음 흥미로운 것은 내 GCC 키트 또는 QtCreator에서 연타 키트를 사용하는지, 항상이 줄에 표시된 컴파일러 출력에 연타를 호출하는 것이다 :
clang++ -c -pipe -std=c++17 -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_DATAVISUALIZATION_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AIRadioQt -I. -I../src -I../src/AIBase -I../src/Maths -I../src/Random -isystem /usr/local/include/csound -I../../../../Programming/Qt/5.10.0/gcc_64/include -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtDataVisualization -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtWidgets -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtGui -I../../../../Programming/Qt/5.10.0/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I../../../../Programming/Qt/5.10.0/gcc_64/mkspecs/linux-clang -o main.o ../AIRadioQt/main.cpp
그리고 다시 연타를 언급 이 포함 플래그 그 줄의 끝 부분 :
-I../../../../Programming/Qt/5.10.0/gcc_64/mkspecs/linux-clang
나는 배는 키트를 확인해야하고, GCC 하나는 확실히 GCC와 GCC++를 호출하고 연타 하나는 확실히 ++ 연타와 연타를 호출합니다. 실행 가능한 링크를 확인하고 단계별로 링크 경로를 따라 갔다./usr/bin/gcc는/usr/bin/x86_64-linux-gnu-gcc-7과/usr/bin/g ++가/usr/bin/x86_64-linux-gnu-g ++ - 7. GCC 키트를 선택했을 때 왜 GCC 대신 Clang을 호출해야하는지에 대해 저는 당황 스럽습니다! 그럼에도 불구하고, GCC와 Clang 모두의 제 버전은 C++ 17을 지원하므로 어쨌든이 문제는 내 문제의 원인이되어서는 안됩니다.
명령 행에서'-std = gnu ++ 17 '뒤에'-std = gnu ++ 11'이 * 나타납니다. 어쩌면 그것을 무시할 수 있을까요? – Galik
좋아, 가지고 있었다는 것을 정확히 알았습니까? 나는 내 깃발을 제거 할 것이다. 나는 그 질문에서 작은 것이 그것을 고쳤을지도 모른다라고 생각했다. –
@Galik 어쩌면'-std = gnu ++ 17'이라면 수정 될 것입니까? 확실하지는 않지만 일반적으로 QtCreator를 사용하지 않습니다. –