、cmakeの2.8.12.2でのlinuxでQtのプロジェクトをビルドする方法、Qt5.6.2(組み込み版)は、GNUは私がcmake PathToSource -G "Eclipse CDT4 - Unix Makefiles"
とcmakeのを実行した後3.81
私はUbuntuの14.04を使用していますcmakeの
を作ります私はmake
です。私は#error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)." # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
Qt5.7.0
のソースファイルをダウンロードして問題なくビルドしてインストールします。私はもう一度cmake PathToSource -G "Eclipse CDT4 - Unix Makefiles"
、それを行う。 /home/sflee/Documents/Software_dev/3rd_party/Qt5.7.0/include/QtCore/qhash.h:957:10: error: ‘pair’ does not name a type auto pair = qAsConst(*this).equal_range(akey);
と/home/sflee/Documents/Software_dev/3rd_party/Qt5.7.0/include/QtCore/qbasicatomic.h:285:14: error: ‘Ops’ has not been declared { return Ops::fetchAndAddRelease(_q_value, valueToAdd); }
など、多くのエラーが発生しますか?
'Qt5.7.0'を' g ++ 4.8.4'でビルドして '-std = C++ 11'を追加します。 Qtが-reduce-relocationsでビルドされている場合は、位置独立コードでコードをビルドする必要があります。 ""コードをコンパイルするには - fPIC(-fPIEで十分ではありません)」 #error "Qtが-reduce-relocations。" \ 'で構築されている場合は、コードを位置独立コードでビルドする必要があります。 /。\ – sflee
さて、 '-std = C++ 11'を追加したのと同じように、プロジェクトコンパイラフラグに' -fPIC'を追加してください。 – hyde
'set(CMAKE_CXX_STANDARD 11)'を使ってCMakeがstdフラグを単独で管理するようにすることもできます。 – Zouch