1

I am trying to include shapelib in an existing solution in MSVS 2010. However, I'm getting the following errors for each function call from shapelib:

error LNK2001: unresolved external symbol "extern "C" void __clrcall SHPDestroyObject(struct SHPObject *)" (?SHPDestroyObject@@$$J0YMXPEAUSHPObject@@@Z)    *.obj

So far what I've done was include the "shapefil.h" file in the *.cpp file (the same file name which gives the error for the *.obj). Also, I've added

$(SolutionDir)$(Platform)\$(Configuration)\shapelib.lib

to Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies. What should I do to fix this issue? I'm fairly new including external libraries so any help would be appreciated.

rosco
  • 11
  • 2
  • Perhaps you forgot to wrap the include of shapefil.h to extern "C"? – dmi Feb 17 '16 at 16:04
  • At the top of shapefil.h is: #ifdef __cplusplus extern "C" { #endif Is this what you mean? – rosco Feb 17 '16 at 16:19
  • I ment mostly in your source file, but this seems slightly same. Perhaps then you could show the exact command lines to the compiller and linker? – dmi Feb 17 '16 at 16:31
  • I think I fixed it using a work around. I erased the shapelib.lib from the additional dependencies and included shpopen.c and safileio.c into my project. Didn't get any errors at least. – rosco Feb 17 '16 at 16:43

0 Answers0