I tried to port a LabCVI Project to MSVS 2010 C++ Express. There is a line of code which reads like this:
if (InitCVIRTE == 0) return 0;
A Linker Error occurs: LNK2019 "_InitCVIRTEEx@12" - all relevant header already feature the cpp statements:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
I traced the error back to these snippets, that I combined for you:
#define CVIFUNC __stdcall
int CVIFUNC InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);
#define InitCVIRTE InitCVIRTEEx
To sum this up:
int __stdcall InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);
This Call should be defined in the cvirt.lib - which is added to the Librarypaths (CVI2009\extlib\msvc) The Linker Error still occurs and I just don't get why.
Should the lib be added in a different way? How can I verify that this really is the right lib? Does the Error mean something completely different?
You need to tell the linker what libraries to link in. The search path will only tell the linker where to find those libraries.
i.e:
Linker Libraries:
- a.lib
- b.lib
Linker Search Dirs:
C:\project_a\lib
C:\project_b\lib
the linker will search both folders for a.lib and b.lib but will not link any libraries it hasnt been told about.