我使用Microsoft Visual Studio 2008爲C++編譯了NTL inifite精度整數算術庫。我在this site上使用Visual Studio接口而不是從命令提示符。其實我寧願從命令提示符下執行它,但我不知道如何執行。爲Windows編譯和使用NTL C++庫
無論如何,我已經編譯了庫,現在我想從命令提示符下使用庫編譯程序。我試圖編譯程序,已經在Linux系統中,在那裏我有以下
c++ -I/appl/htopopt/Linux_x86_64/NTL-5.4.2/include mpqs.cpp main.cpp -o main -L/appl/htopopt/Linux_x86_64/NTL-5.4.2/lib -lntl -L/appl/htopopt/Linux_x86_64/gmp-4.2.1/lib -lgmp -lm
沒關係了GMP的東西編譯上測試,我沒有在Windows所安裝。這純粹是可選的事情,將使NTL運行更快。無論如何,這在Linux上正常工作。現在在Windows上我寫了下面的
cl /EHsc /I D:\Downloads\WinNTL-5_5_2\include mpqs.cpp main.cpp /link /LIBPATH:"D:\Documents\Visual Studio 2008\Projects\ntl\Debug"
但是這會導致以下錯誤:
mpqs.cpp
mpqs.cpp(38) : error C2039: 'find_smooth_vals' : is not a member of 'QS'
d:\desktop\qs\mpqs.h(12) : see declaration of 'QS'
mpqs.cpp(41) : error C2065: 'M' : undeclared identifier
mpqs.cpp(41) : error C2065: 'n' : undeclared identifier
mpqs.cpp(42) : error C2065: 'sieve_table' : undeclared identifier
mpqs.cpp(42) : error C2228: left of '.size' must have class/struct/union
type is ''unknown-type''
mpqs.cpp(43) : error C2065: 'sieve_table' : undeclared identifier
mpqs.cpp(44) : error C2065: 'qx_table' : undeclared identifier
mpqs.cpp(44) : error C3861: 'test_smoothness': identifier not found
mpqs.cpp(45) : error C2065: 'smooth_indices' : undeclared identifier
mpqs.cpp(45) : error C2228: left of '.push_back' must have class/struct/union
type is ''unknown-type''
main.cpp
Generating Code...
它是那樣的話,我的mpqs.h文件不包含在編譯過程?另外我不明白爲什麼它抱怨.push_back()的矢量類型?
非常感謝幫助!
NTL嚴重過時,請使用[MPIR](http://mpir.org/)代替 – bobobobo 2011-10-11 23:57:52