我已经使用 Microsoft Visual Studio 2008 为 c++ 编译了 NTL inifite 精度整数算术库。我按照说明在此站点上使用 Visual Studio 界面而不是从命令提示符处进行了操作。实际上,我宁愿从命令提示符处执行此操作,但我不知道该怎么做。
无论如何,我编译了库,现在我想在命令提示符下使用该库编译一个程序。我正在尝试编译的程序已在 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() ?
非常感谢您的帮助!