Linking in VS2017

Hello!

I have trouble linking LexActivator in VS2017 (x64). I’m new to cryptlex and I develop normally under Linux thus my Visual Studio experience is limited. The page

https://docs.cryptlex.com/node-locked-licenses/using-lexactivator/using-lexactivator-with-c-c++-and-objective-c

says: " LexActivator example project for C contains the LexActivator.h header file. In addition to that it includes LexActivator.lib"

This is not true, LextActivator.lib is not contained in the project. I have downloaded and copied it into the x64 directory. Then I opened Sample->Properties->Linker->Input and under AdditionalDependencies added
x64/LexActivator.lib;x64/libcurl_MD.lib;%(AdditionalDependencies)

It compiles but the linker complains:

1>Sample.obj : error LNK2001: unresolved external symbol __imp_GetLicenseExpiryDate
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetTrialActivationMetadata
1>Sample.obj : error LNK2001: unresolved external symbol __imp_ActivateTrial
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetAppVersion
1>Sample.obj : error LNK2001: unresolved external symbol __imp_ActivateLicense
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetProductId
1>Sample.obj : error LNK2001: unresolved external symbol __imp_IsTrialGenuine
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetLicenseKey
1>Sample.obj : error LNK2001: unresolved external symbol __imp_IsLicenseGenuine
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetProductData
1>Sample.obj : error LNK2001: unresolved external symbol __imp_GetTrialExpiryDate
1>Sample.obj : error LNK2001: unresolved external symbol __imp_SetActivationMetadata
1>C:\lexact\examples\x64\Release\Sample.exe : fatal error LNK1120: 12 unresolved externals
1>Done building project “Sample.vcxproj” – FAILED.

Please let me know how to solve the issue. Thank you.

Hi,

The .lib file can be downloaded from the downloads page in the dashboard. The GitHub sample only contains the header file and sample, the library can be downloaded from the dashboard. The sample.cpp shows how to add library to the code, you don’t need to add that through Visual studio settings.

Thank you. I didn’t know that libs can also be added through #pragma. I have unzipped LexActivator-Static-Win-VC15-2.zip\libs\x64 to the x64-directory and I have added the x64 platform using the configuration manager of VS2017. Now the linker says:

1>LINK : fatal error C1047: The object or library file 'x64\LexActivator.lib' was created with an older compiler than other objects; rebuild old objects and libraries
1>LINK : fatal error LNK1257: code generation failed

My VS2017 version is:

Microsoft Visual Studio Community 2017 
Version 15.9.6
VisualStudio.15.Release/15.9.6+28307.344
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Community

Visual C++ 2017   00369-60000-00001-AA071
Microsoft Visual C++ 2017

ASP.NET and Web Tools 2017   15.9.04012.0
ASP.NET and Web Tools 2017

C# Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

JavaScript Language Service   2.0
JavaScript Language Service

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

MLGen Package Extension   1.0
MLGen Package Visual Studio Extension Detailed Info

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Visual Basic Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

In visual studio change the the toolset to v140

But v140 is the toolset of VS2015 while the download was for VS2017. Is v141 not supported yet?

Nevertheless, I have tried and now the linker complains: Error 1007, not recognized flag “-Ot” in “p2”. This is strange because the linker properties do not show such a flag.

Hi Geom,

Can you try compiling the fresh sample project with v140 toolset?

Thank you for your quick reply. I have deleted everything, downloaded the VS2015 version and it compiles with toolset v140.

But I wonder why a VS2017 download is offered that requires toolset v140 of VS2015: Isn’t that the same as the VS2015 download?

This was a bug in the release, which was fixed I guess. Will look into this issue again.