LNK2019 error- exampleMain

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Andrea Roberti
Posts: 3
Joined: Wed May 07, 2014 4:54 am

LNK2019 error- exampleMain

Post by Andrea Roberti » Tue May 13, 2014 7:04 am

Hi guys, i'm having linker error LNK2019.

I followed tutorials, but i've only one thing different : i'm using Visual Studio 2013 Express.
So in Cmake my current generator is Visual Studio 12

I checked everything (libs, building 32, debug etc) , and also read old topic (https://simtk.org/forums/viewtopic.php? ... 1120#p7764)

-----------------------------------------------------------------------------------Output
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: virtual __thiscall OpenSim::Exception::~Exception(void)" (__imp_??1Exception@OpenSim@@UAE@XZ) non risolto nella funzione __catch$_main$0
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: char const * __thiscall OpenSim::Exception::getMessage(void)const " (__imp_?getMessage@Exception@OpenSim@@QBEPBDXZ) non risolto nella funzione __catch$_main$0
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: void __thiscall OpenSim::Object::setName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?setName@Object@OpenSim@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto nella funzione _main
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno __imp__RegisterTypes_osimCommon non risolto nella funzione "public: __thiscall osimInstantiator::osimInstantiator(void)" (??0osimInstantiator@@QAE@XZ)
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: virtual __thiscall OpenSim::StateVector::~StateVector(void)" (__imp_??1StateVector@OpenSim@@UAE@XZ) non risolto nella funzione "public: virtual void * __thiscall OpenSim::StateVector::`vector deleting destructor'(unsigned int)" (??_EStateVector@OpenSim@@UAEPAXI@Z)
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: __thiscall OpenSim::Model::Model(void)" (__imp_??0Model@OpenSim@@QAE@XZ) non risolto nella funzione _main
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno "__declspec(dllimport) public: virtual __thiscall OpenSim::Model::~Model(void)" (__imp_??1Model@OpenSim@@UAE@XZ) non risolto nella funzione _main
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno __imp__RegisterTypes_osimSimulation non risolto nella funzione "public: __thiscall osimInstantiator::osimInstantiator(void)" (??0osimInstantiator@@QAE@XZ)
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno __imp__RegisterTypes_osimActuators non risolto nella funzione "public: __thiscall osimInstantiator::osimInstantiator(void)" (??0osimInstantiator@@QAE@XZ)
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno __imp__RegisterTypes_osimAnalyses non risolto nella funzione "public: __thiscall osimInstantiator::osimInstantiator(void)" (??0osimInstantiator@@QAE@XZ)
2>TugOfWar1_CreateModel.obj : error LNK2019: riferimento al simbolo esterno __imp__RegisterTypes_osimTools non risolto nella funzione "public: __thiscall osimInstantiator::osimInstantiator(void)" (??0osimInstantiator@@QAE@XZ)
2>C:\Users\Andrea\Desktop\OpenSimWorkSpace\Test\build\RelWithDebInfo\exampleMain.exe : fatal error LNK1120: 11 esterni non risolti
--------------------------------------------------------------------------------

I've also had another problem -> signbit already has a body (in common.h and Scalar.h) and I solved it by adding

#if _MSC_VER < 1800
[ .......signbit.......]
#endif

Regards,
Andrea

User avatar
Andrea Roberti
Posts: 3
Joined: Wed May 07, 2014 4:54 am

Re: LNK2019 error- exampleMain

Post by Andrea Roberti » Wed May 14, 2014 3:17 am

Solved!

The problem was the Installer.

OpenSim-3.2.0-win64VC10P.exe ----changed ---> OpenSim-3.2.0-win32VC10P.exe

and it works!

Andrea

User avatar
Ayman Habib
Posts: 2234
Joined: Fri Apr 01, 2005 12:24 pm

Re: LNK2019 error- exampleMain

Post by Ayman Habib » Wed May 14, 2014 10:45 am

Thanks Adrea for reporting back.

Looks like the problem was trying to build 32 bit application using the 64 bit libraries. While doing CMake configuration you should be able to choose the build environment that matches your installer ( win64 for 64 bit).

Do you still need to make the change to handle signbit?
I've also had another problem -> signbit already has a body (in common.h and Scalar.h) and I solved it by adding

#if _MSC_VER < 1800
[ .......signbit.......]
#endif
Thanks,
-Ayman

User avatar
Andrea Roberti
Posts: 3
Joined: Wed May 07, 2014 4:54 am

Re: LNK2019 error- exampleMain

Post by Andrea Roberti » Thu May 15, 2014 1:44 am

Hi Ayman,
yes,was my fault !

If i use Visual studio 2013 express i've still to change the headers (common.h and Scalar.h)


Andrea

User avatar
Kevin Tanghe
Posts: 36
Joined: Mon Sep 22, 2014 6:54 am

Re: LNK2019 error- exampleMain

Post by Kevin Tanghe » Wed Oct 15, 2014 7:43 am

I used CMake with the Visual Studio 10 2010 Win64 generator.
I can build the file with Visual Studio and run the .exe file in the Release folder.
However, when I click the Green arrow in Visual Studio to run the file I get the following error:

Unable to start program 'C:\OpenSimWorkspace\ExampleMain\build\x64\Release\ALL_BUILD'
The system cannot find the file specified.

What would be the problem?

User avatar
Ayman Habib
Posts: 2234
Joined: Fri Apr 01, 2005 12:24 pm

Re: LNK2019 error- exampleMain

Post by Ayman Habib » Wed Oct 15, 2014 10:00 am

Hi Kevin,

When you hit the run button in VisualStudio it tries to run the current project (shown in bold in Solution Explorer). It looks like your current project is ALL_BUILD which builds everything but is not a program to run. In order to run the program, make it the current project (right mouse click on ExampleMain and select "Set as Startup Project" and then it will run the correct program when you hit the green arrow.

Hope this helps,
-Ayman

User avatar
Kevin Tanghe
Posts: 36
Joined: Mon Sep 22, 2014 6:54 am

Re: LNK2019 error- exampleMain

Post by Kevin Tanghe » Thu Nov 06, 2014 12:48 pm

Yes, this works. Thank you.

User avatar
leosky kidd
Posts: 3
Joined: Mon Oct 26, 2015 3:08 am

Re: LNK2019 error- exampleMain

Post by leosky kidd » Wed Oct 28, 2015 2:03 am

Dear Ayman& Andrea

I'm new to opensim and have been following the tutorial

I was managed to configure and generate in Cmake using visual studio 2015 but I couldn't build the solution for ALL_Build and kept getting the same LNK2019 error.

I installed the opensim 3.3 64bit. I understand that it was the "trying to build 32bit application with 64bit library" thing (Is there any 64bit library in opensim 3.3) but would it be possible to alter the examplemain to 64bit application?

What is the differences between opensim 3.3 32bit and 64bit?

Best regards,
Leosky

User avatar
Tanyaporn Pungrasmi
Posts: 5
Joined: Thu Nov 26, 2015 5:15 pm

Re: LNK2019 error- exampleMain

Post by Tanyaporn Pungrasmi » Wed Jan 13, 2016 7:08 pm

Dear everyone,

I have a problem while running myAnalysis.cpp in the Creating Your Own Analysis example.
I use visual studio 2015 running on window7 32bit
Its built successfully but cannot debug
I tired to set the myAnalysisPlugin as a startup project already,
but it showed
Unable to start program
'C:\OpenSimWorkspace\sdk\APIExamples\Plugins\AnalysisPluginExample-build\Release\myAnalysisPlugin.dll'.

C:\OpenSimWorkspace\sdk\APIExamples\Plugins\AnalysisPluginExample-build\Release\myAnalysisPlugin.dll is not a valid Win32 application

I did everything according to the example. Did I miss something?
Could anyone please recommend what should I do?


Thank you,
Tanya

POST REPLY