0
votes

I know many people have asked about this error and trust me I've read ALL of them and followed all the steps! But I'm still getting the unresolved external symbol error.

I'm trying to use the dll of lp_solve (a linear programming package) in my c++ code in visual studio 2012. The error message I'm getting is: Error 80 error LNK2019: unresolved external symbol _make_lp@8 referenced in function "void __cdecl my_solve(BLAH BLAH)

The function make_lp() is from the lp_solve package and I'm calling it from my_solve() in my code. This error message pops up for each solver function I call. Seems the linker just couldn't find any of the implementation of these functions.

I've done the following

  1. put #include "lp_lib.h" in my source code
  2. put the .dll, .h and .lib files from the lp_solve package in the working directory and
  3. added the path under Linker:General:Additional Library Directories.
  4. added the lib under Linker:Input:Additional dependency

What's wrong? Thanks for your help!

2
can you please post the full error message? - Yu Zhang
just updated with the error message. - forrest

2 Answers

2
votes

The problem I had was solved after realizing I downloaded the WIN64 package for lp_solve but my visual studio is using WIN32 as build platform (even though my machine is x86_64).

0
votes

Using extern "C" may be helpful while including lp_lib.h in your .cpp as follows:

extern "C"
{
#include "lp_lib.h"
}

For more information, please check this link: http://www.geeksforgeeks.org/extern-c-in-c/