2012-08-01 77 views
5

我最近將OSX升級爲山獅,並且因爲無法再使用Qt Creator編譯我的項目。我得到一堆錯誤類似如下:OSX升級後QtCreator構建系統崩潰

/Users/user/codes/lib/io/xdmfWriter.cpp:63: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available

/Users/user/codes/lib/io/xdmfWriter.cpp:-1: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':

/Users/user/codes/lib/io/xdmfWriter.cpp:63: instantiated from here

// xdmfWriter.cpp -- line 63: 
gridName << xdmfName_ << "." << timeStep; 

gridNamestd::ostringstream對象和xdmfName_被聲明爲xdmfWriter的私有成員一個std::string變量類並在類的構造函數中初始化。我之前沒有這個問題......任何想法?

回答

6

這可以通過添加c_str()在固定:

gridName << xdmfName_.c_str() << "." << timeStep; 

但是,這不是一個永久的解決方案。

更新:我發現https://web.archive.org/web/20140809210004/http://qt-project.org/forums/viewthread/19106/P15

解決方案需要在$QTDIR/mkspecs/common/g++-macx.conf改變-mmacosx-version-min=10.5-mmacosx-version-min=10.7。 這是因爲10.5或10.6的SDK不包含在Mountain Lion和XCode 4.4中。

+0

呃...我有點卡在這個.. QT在哪裏轉儲所有的東西與標準安裝? – 2013-01-19 11:21:24

+1

你可以運行'qmake -v'來獲取你的qt目錄的位置,對我來說就是'/ usr/local/Cellar/qt/4.8.4/lib'。然後,'mkspecs'目錄將會高於該目錄,或者對於我的例子來說,是'/ usr/local/Cellar/qt/4.8.4/mkspecs'。 – sordid 2013-02-27 14:49:49

2

聽起來像是如果我使用Clang工具鏈(其中強制的clang++代替llvm-g++)我沒有這個問題...

+0

你是怎麼做到的? QT Creator中的一些選項還是別的? – 2013-01-19 11:18:35

+0

@SamJarman取決於QtCreator版本。在Qt版本>工具鏈之前。對於新版本(2.6我猜)整個事情變成了「工具包」... – GradGuy 2013-01-20 00:44:22

6

我試過改變g ++ - macx.conf fila但我仍然收到錯誤。我發現使用:

QMAKE_CXXFLAGS += -fpermissive 

在我的專業文件做了伎倆。

+0

這是正確的答案。也幫助了我。 – 2012-12-03 20:36:56

+0

嘗試過,作品,謝謝:) – destan 2013-03-18 08:23:02