I have just installed Visual Studio 2017 and I want to use the NTL library. I have followed the steps described here (for VS2013). Compiling NTL library in Visual Studio 2013
As expected, it compiles (with several, I hope, negligible warnings).
Then, under the same solution, I am doing these consecutive steps: (under the same solution)
- Add project -> New project -> Visual C++ -> Win32 Console Appl.
- Right click on the created project -> Set as StartUp Project
- Right click on the created project -> Add -> Reference -> NTL
- Right click on the created project -> Configuration Properties -> C/C++ -> General -> Additional Include Directories -> (NTL includes)
- Take/copy some file from folder "tests" (downloaded from the NTL repository)
- Remove everything below #include "stdafx.h"
- Paste and build
Those steps should work on VS2013 & VS2015, unfortunately when I build I got 4 linker related errors (LNK2019).
They all are similar to the example below:
Error LNK2019 unresolved external symbol "void __cdecl NTL::MatPrime_crt_helper_deleter(class NTL::MatPrime_crt_helper *)" (?MatPrime_crt_helper_deleter@NTL@@YAXPAVMatPrime_crt_helper@1@@Z) referenced in function "public: static void __cdecl NTL::ZZ_pInfoT::MatPrime_crt_helper_deleter_policy::deleter(class NTL::MatPrime_crt_helper *)" (?deleter@MatPrime_crt_helper_deleter_policy@ZZ_pInfoT@NTL@@SAXPAVMatPrime_crt_helper@3@@Z) NTLtest <thePathToTheLib> (ZZ_p.obj) 1
Can you advice how to proceed?
I have tried to built this example -> ZZ_pEXTest.cpp
Thank you in advance!
First, I am assuming you get the same 4 errors I do. I get the one you showed in your question, plus three more. In all cases, it involves a forward declaration of a method or function that does actually exist in the code.
However, the types in the declarations are classes and the types in the implementation are structs. The function signature is therefore not the same and the linker can't find the implementation.
So, I simply updated the the forward declarations of the parameter types to be what they should be: structs.
In lip.h, change
_ntl_general_rem_one_struct
to be astruct
. In ZZ_p.h, changeMatPrime_crt_helper
to be astruct
.I believe this is all I did.
You shouldn't really have to make changes to the code. There may be a compiler switch, or it only fails in VS. I don't know. All I know is it is written by someone a lot smarter than me, and life is too short; I've made my changes and I'm moving on.