Question

I follow the insturction to compile glpk on windows, then I got glpk_4_52.lib and glpk_4_52.dll. In my VC 2010 project, I include head file

#include "glpk.h"

and I include glpk_4_52.lib in "additional library directory".

But after compiling it still shows:

error LNK2019, "unresolvant external symbols", _glp_create_prob, referenced in _main and similar others.

Could anyone knows what the problem is here? Thanks!d

Was it helpful?

Solution

"Additional library directory" is not the right way to add a lib file to the link.

Either,

Add glpk_4_52.lib in Configuration Properties -> Linker -> Input -> Additional Dependencies

or

Make the glpk project a dependency of your EXE project, if they are in the same solution, bu using "Project Dependencies" and make sure that Configuration Properties -> Linker -> General -> Link library dependencies is set to Yes

I am able to reproduce your problem by using the H and LIB version 4_52 from the precompiled package on SourceForge, by forcing the calling convention of my EXE to __stdcall (/Gz) (In C++->Adanced).

You should use __cdecl (/Gd) instead!

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