0

I have a C++ library (downloaded here). In the library, there are some ".h" header files, ".cc" files containing the code and two static ".lib" that are included in a "win32" folder. I am doing solely a x64 project in Visual Studio 2012 C++.

In order to use the library, I specified, in the "Additional Include Directories" of the property page, the path to the .h files. In the "Additional Library Directories", I specified the path to the folder containing both ".lib" files. In the "Additional Dependencies", I put the name of all the ".lib" files that could be found in the "Additional Library Directories". In the "Debug" mode, I use the debug version of the libraries if available.

In the code, I add an #include < brisk.h> to indicate that I want to use that library. I also use other libraries but they cause no error.

Now, I have a

"LNK2019 unresolved external symbol "public: __cdecl cv:: ...etc" 

error at compilation. I wonder if this could be caused by the facts that some ".lib" are maybe compiled in win32 instead of x64. Is that a possible error?

If it is evident I am doing something wrong, please tip me. I have consulted this question but I am not so sure...

Edit :

Here is the output of the compiler:

1>------ Build started: Project: BRISK_opencv2, Configuration: Debug x64 ------
1>  BRISK_opencv2.cpp
1>BRISK_opencv2.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::BriskDescriptorExtractor::BriskDescriptorExtractor(bool,bool,float)" (??0BriskDescriptorExtractor@cv@@QEAA@_N0M@Z) referenced in function main
1>BRISK_opencv2.obj : error LNK2019: unresolved external symbol "public: __cdecl cv::BriskFeatureDetector::BriskFeatureDetector(int,int)" (??0BriskFeatureDetector@cv@@QEAA@HH@Z) referenced in function main
1>C:\...\x64\Debug\BRISK_opencv2.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Community
  • 1
  • 1
Doombot
  • 553
  • 3
  • 8
  • 18

2 Answers2

1

You can't use 32-bit and 64-bit code in the same process.

The linker should tell you if it is skipping input files you instructed it to use due to an incompatible architecture. Read all the linker output, not just the errors.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
1

Use

dumpbin win32.lib /headers

The line starting with machine will tell you what sort of architecture it is expecting

At the end of FILE HEADER VALUES, before OPTIONAL HEADER VALUES, it will tell you whether it is expecting 32-bit or 64 bit.

It could be that the lib is for 64 bit but IA64 instead of X64. That would still be incompatible.

cup
  • 7,589
  • 4
  • 19
  • 42
  • hmmm I typed it in the Command Window in Visual Studio, but no command "dumpbin" or "DUMPBIN" are found. I replaced win32.lib by MyLib.lib and it didn't work, too... – Doombot Mar 31 '15 at 18:44
  • 1
    It should be in VC\bin. The express versions have dumpbin so I'd expect whichever version you're using to have it. Did you use the cmd prompt from visual studio or from windows? If you used it from windows, you need to run VC\bin\vcvars32.bat first. – cup Mar 31 '15 at 18:50
  • Ok after some fiddling I managed to launch dumpbin. Too many text is prompted on the console so I am unable to look at the FILE HEADER VALUES. Anyway thanks, I'll try to make it work – Doombot Mar 31 '15 at 19:53
  • 1
    use *dumpbin win32.lib /headers > win32.log* Then look at win32.log in the editor – cup Mar 31 '15 at 19:55