PDA

View Full Version : Linking to windows libs failure



yi gi
19th October 2015, 10:50
Hi All,
In my project I am trying to link to the libs Imm32.lib, Winmm.lib, ws2_32.lib and User32.lib but I can't seem to make it work.
any idea what I'm doing wrong?

.PRO:


INCLUDEPATH += "C:\\OpenCV-2.4.11\\opencv\\build\\include" \
"C:\\OpenCV-2.4.11\\opencv\\build\\include\\opencv" \
"C:\\OpenCV-2.4.11\\opencv\\build\\include\\opencv2" \
"C:\\Program Files (x86)\\Cypress\\EZ-USB FX3 SDK\\1.3\\library\\cpp\\inc" \
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\Include"

CONFIG(debug, debug | release) {
LIBS += -L"C:\\OpenCV-2.4.11\\opencv\\build\\x86\\vc10\\lib" \
-lopencv_core2411d \
-lopencv_highgui2411d \
-lopencv_imgproc2411d \
-lopencv_features2d2411d
LIBS += -L"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\Lib\\x86" \
-limm32 \
-lwinmm \
-lws2_32 \
-luser32
LIBS += -L"C:\\Program Files (x86)\\Cypress\EZ-USB FX3 SDK\\1.3\\library\cpp\\lib\\x64\\CyAPI.lib" \
}

CONFIG(release, debug | release) {
LIBS += -L"C:\\OpenCV-2.4.11\\opencv\\build\\x86\\vc10\\lib" \
-lopencv_core2411 \
-lopencv_highgui2411 \
-lopencv_imgproc2411 \
-lopencv_features2d2411
LIBS += -L"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\Lib\\x86" \
-limm32 \
-lwinmm \
-lws2_32 \
-luser32
LIBS += -L"C:\\Program Files (x86)\\Cypress\\EZ-USB FX3 SDK\\1.3\\library\cpp\\lib\\x64\\CyAPI.lib"
}

ChrisW67
19th October 2015, 11:59
What doesn't work about it?

You seem to trying to build a generic Win32 application with no Qt components. If that is the case you may as well use the Visual Studio tools directly.

yi gi
19th October 2015, 12:35
I have a generic Win32 application that I'm trying to embed (with tweaks) into a QT application.
Specifically I need to incorporate the Cypress USB Library CyAPI library but get linkage errors such as:


camera.obj:-1: error: LNK2019: unresolved external symbol "public: bool __thiscall CCyUSBEndPoint::XferData(unsigned char *,long &,class CCyIsoPktInfo *)" (?XferData@CCyUSBEndPoint@@QAE_NPAEAAJPAVCCyIsoPkt Info@@@Z) referenced in function "public: bool __thiscall Camera::SendDataToRegister(int,int)" (?SendDataToRegister@Camera@@QAE_NHH@Z)


From what I was able to gather I need those Win32 libraries to solve these errors, hence my current predicament.

ChrisW67
19th October 2015, 21:01
You are directing the linker to the 64-bit "../lib/x64/" version of the USB library and 32-bit versions of Windows API and OpenCV. These need to match the bit-ness of your program.

Do yourself a favour and change all the "\\" in PRO file paths to "/" and improve the reability.
I would also consider commenting out the Windows SDK stuff until you are certain they are needed.