-1

I am trying to run some code using Visual Studios 2013, OpenCV 2.4.9 and Qt 5.4 on an x64 Windows 7 Desktop computer. The code runs fine when I set the solution platform to Win32. However, in order for me to continue this project, I need to next implement Microsoft´s Magnification API which has be run on my computer´s native OS type because of some bug they haven´t resolved. But when I configure all the settings to run on x64, I get the following error:

1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl INTRAFACE::FaceAlignment::FaceAlignment(char const *,char const *,class INTRAFACE::XXDescriptor const *,class cv::Rect_<double> const &)" (__imp_??0FaceAlignment@INTRAFACE@@QEAA@PEBD0PEBVXXDescriptor@1@AEBV?$Rect_@N@cv@@@Z) referenced in function "private: void __cdecl MainWindow::detect(class cv::VideoCapture,bool)" (?detect@MainWindow@@AEAAXVVideoCapture@cv@@_N@Z)
1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum INTRAFACE::IFRESULT __cdecl INTRAFACE::FaceAlignment::Track(class cv::Mat const &,class cv::Mat const &,class cv::Mat &,float &)" (__imp_?Track@FaceAlignment@INTRAFACE@@QEAA?AW4IFRESULT@2@AEBVMat@cv@@0AEAV45@AEAM@Z) referenced in function "private: void __cdecl MainWindow::detect(class cv::VideoCapture,bool)" (?detect@MainWindow@@AEAAXVVideoCapture@cv@@_N@Z)
1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum INTRAFACE::IFRESULT __cdecl INTRAFACE::FaceAlignment::Detect(class cv::Mat const &,class cv::Rect_<int> const &,class cv::Mat &,float &)" (__imp_?Detect@FaceAlignment@INTRAFACE@@QEAA?AW4IFRESULT@2@AEBVMat@cv@@AEBV?$Rect_@H@5@AEAV45@AEAM@Z) referenced in function "private: void __cdecl MainWindow::detect(class cv::VideoCapture,bool)" (?detect@MainWindow@@AEAAXVVideoCapture@cv@@_N@Z)
1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum INTRAFACE::IFRESULT __cdecl INTRAFACE::FaceAlignment::EstimateHeadPose(class cv::Mat const &,struct INTRAFACE::HeadPose &)" (__imp_?EstimateHeadPose@FaceAlignment@INTRAFACE@@QEAA?AW4IFRESULT@2@AEBVMat@cv@@AEAUHeadPose@2@@Z) referenced in function "private: void __cdecl MainWindow::detect(class cv::VideoCapture,bool)" (?detect@MainWindow@@AEAAXVVideoCapture@cv@@_N@Z)
1>mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl INTRAFACE::FaceAlignment::~FaceAlignment(void)" (__imp_??1FaceAlignment@INTRAFACE@@QEAA@XZ) referenced in function "private: void __cdecl MainWindow::detect(class cv::VideoCapture,bool)" (?detect@MainWindow@@AEAAXVVideoCapture@cv@@_N@Z)
1>Q:\eyegaze\x64\Release\\EyeGazeDemo.exe : fatal error LNK1120: 5 unresolved externals

INTRAFACE::FaceAlignment comes from an Intraface library (which is x86) Is this whats causing the problem? If so, how can I go about fixing this?

Thanks!

Joissa.R
  • 111
  • 1
  • 3
  • 8
  • 3
    Yes, if you want to run this as x64 code, you need an x64 version of the library. – Bo Persson Aug 17 '15 at 17:08
  • @BoPersson Is there a way that I can fix this myself? ( I dont think there is an x64 version available for download) – Joissa.R Aug 17 '15 at 17:12
  • 3
    Not unless you have all the source code, and can build the x64 version yourself. – Bo Persson Aug 17 '15 at 17:17
  • Qt and OpenCV have 64 bit binaries for Visual Studio 2013. Although they are both pretty easy to build from the source code if you can't find the version you want for the compiler you are using. – drescherjm Aug 17 '15 at 17:53

1 Answers1

0

I'm not familiar with OpenCV but this page on their web site suggests that you should have separate bin and lib folders for each platform type. By convention, lib folders are where libraries used by the linker to satisfy unresolved symbols may be found.

The first thing you need to do is to figure out whether or not you have the necessary x64 BIN and LIB folders for OpenCV. Assuming that you do have the x64 folders, the next step is to figure out why your x86 build links successfully while your x64 build does not.

It's just a guess but a common slip when creating new platform targets is to forget to adjust entries to account for third-party packages like OpenCV. For example you may have adjusted the Library Directories entry under VC++ Directories (in the C++ Project Properties) to include the x86 LIB folder when you first created the project but forgot to make the corresponding x64 LIB folder entry in the x64 version of project properties.

Other C++ project properties to check include Additional Library Directories under Linker > General and Additional dependencies under Linker > Input.

In each case you need to make sure that if the property is set in your x86 configuration there is a suitable corresponding setting in your x64 configuration.

It's a bit laborious but, by opening the Project Properties dialog and switching the Platform drop-down between x86 and x64 you should be able to see differences in settings. IIRC you can also set the Platform drop-down to "All Platforms" and the property page will flag properties that have different values on different platforms. Remember though that some properties are supposed to have different values for different platforms.

Frank Boyne
  • 4,400
  • 23
  • 30