Question

I have compiled the NTL inifite precision integer arithmetic library for c++, using Microsoft Visual Studio 2008. I did as explained, on this site, using the Visual Studio interface, rather than from the command prompt. Actually I would rather do it from the command prompt, but I was not sure how to.

Anyhow, I got the library compiled, and I now want to compile a program using the library, from the command prompt. The program I am trying to compile, has been tested on a linux system, where I compile it with the following

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

Nevermind the gmp stuff, I dont have that installed on Windows. It is purely an optional thing that will make the NTL run faster. Anyhow, this works fine on linux. Now on Windows I write the following

cl /EHsc /I D:\Downloads\WinNTL-5_5_2\include mpqs.cpp main.cpp /link /LIBPATH:"D:\Documents\Visual Studio 2008\Projects\ntl\Debug"

But this results in the following errors:

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...

It is as if, my mpqs.h file is not included into the compilation process? Also I dont understand why it complains about .push_back() for a vector type?

Help is much appreciated!

Was it helpful?

Solution

mpqs.h is definitely being included as the output asks you to refer to it.

Seeing as MPQS.h does not appear to be included in the NTL library ... did you write it? If so can you post the code up?

Also, shouldn't you included the library file somewhere on your build?

Edit: There is no function find_smooth_values so why should you expect MSVC to find it? I'm not sure why that compiles under GCC but its obviously missing. I'm guessing that the other errors are caused because of this one. The errors are telling you things. You should listen to them.

push_back is failing because it doesn't know what the type you are trying to push_back into is. This again is probably caused by the fact that find_smooth_values doesn't exist. Try adding the function prototype into the QS class. This may well fix all your problems.

As for the library it won't get to using the library until the compilation succeeds. So don't worry about that just now. Get in there and fix the errors that MSVC is reporting!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top