我一直試圖在我的mac上編譯一個開源的C++庫(QuantLib-1.7)幾天,但我似乎遇到了某種C++ 11的兼容性問題。使用C++編譯g ++的庫11
當我運行從編譯似乎除了一堆出錯的形式來工作的終端make && sudo make install
Making all in BermudanSwaption
g++ -DHAVE_CONFIG_H -I. -I../../ql -I../.. -I../.. -I/opt/local/include -g -O2 -MT BermudanSwaption.o -MD -MP -MF .deps/BermudanSwaption.Tpo -c -o BermudanSwaption.o BermudanSwaption.cpp
In file included from BermudanSwaption.cpp:22:
In file included from ../../ql/quantlib.hpp:43:
In file included from ../../ql/experimental/all.hpp:25:
In file included from ../../ql/experimental/volatility/all.hpp:21:
In file included from ../../ql/experimental/volatility/zabr.hpp:31:
In file included from ../../ql/math/statistics/incrementalstatistics.hpp:35:
In file included from /opt/local/include/boost/accumulators/statistics/stats.hpp:14:
In file included from /opt/local/include/boost/accumulators/statistics_fwd.hpp:12:
/opt/local/include/boost/mpl/print.hpp:50:19: warning: in-class initialization
of non-static data member is a C++11 extension [-Wc++11-extensions]
const int m_x = 1/(sizeof(T) - sizeof(T));
^
1 warning generated.
我猜這事做與G ++沒有被正確配置爲C + +11。我很熟悉C++ 11可以通過編譯g++ -std=c++11
來調用。但是,儘管有大量的使用Google搜索,但我無法找到修改makefile的方法,因此在運行make && sudo make install
時會調用-std=c++11
。
任何幫助將不勝感激。
這裏是生成文件的我相信部分是相關的:
BOOST_INCLUDE = -I/opt/local/include
BOOST_LIB = -L/opt/local/lib
BOOST_THREAD_LIB =
BOOST_UNIT_TEST_DEFINE = -DQL_WORKING_BOOST_STREAMS
BOOST_UNIT_TEST_LIB = boost_unit_test_framework-mt
BOOST_UNIT_TEST_MAIN_CXXFLAGS = -DBOOST_TEST_DYN_LINK
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS = -I/opt/local/include
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
以下是運行的 「g ++ -v」 輸出:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
Makefile.am:https://www.dropbox.com/s/v5j7qohwfup81od/Makefile.am?dl=0
Makefile.in:https://www.dropbox.com/s/t92hft9ea2ar1zw/Makefile.in?dl=0
QuantLib-1。 7目錄:https://www.dropbox.com/sh/ulj0y68m8x35zg8/AAA-w7L2_YWIP8_KnwURErzYa?dl=0
完整的錯誤日誌:https://www.dropbox.com/s/g09lcnma8skipv7/errors.txt?dl=0
爲什麼不'釀造安裝quantlib'? –
好的,現在就開始拍攝吧。 – user11881
'g ++ -I/opt/local/include/-I/opt/local/include/boost BermudanSwaption.cpp \ > -o bermudanswaption -L/opt/local/lib/-lQuantLib'後跟'。/ bermudanswaption'似乎現在成功運行。這一切似乎很混亂。有什麼地方可以閱讀關於quintib的頭文件和cpp文件是如何在文件系統中組織的?謝謝。 – user11881