[solved] Trying to use library, build error "cannot find -lcbw32d"
I am getting a build error "cannot find -lcbw32d". I am trying to use a library provided with a Measurement Computing DAQ (data acquisition module). The library is called cbw32.lib. I added the library in Qt Creator as Internal Library and it added the following lines in my .pro file:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../DAQ_C/ -lcbw32
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../DAQ_C/ -lcbw32d
INCLUDEPATH += $$PWD/../DAQ_C
DEPENDPATH += $$PWD/../DAQ_C
Now I get the following two build errors:
cannot find -lcbw32d
error: ld returned 1 exit status
Any ideas on how to make this work?
Ron---Qt Creator 3.0.1, Qt 5.2.1 (MSVC 2010, 32 bit)
[Don't know why my Qt version says MSVC, as I installed the MinGW version]
It's the Qt version used to build Qt Creator, not the one you are using
Are you sure you are giving the correct path to the library ?
I'm sorry, I added the library as an External Library (I said Internal before). I point to the exact library file, so yes I am sure the path was correct. Qt generates the "Include path" in the Add Library wizard, and it was correct as well.
For fun, I added as a static library instead, then I get the following build error:
No rule to make target 'C:/Users/ron/Documents/Qt Testing/Notepad/../DAQ_C/libcbw32d.a', needed by 'debug\Notepad.exe'. Stop.
Then do you have a lib file named libcbw32d ?
I changed it back to a dynamic library, and so was getting “cannot find -lcbw32d” again. Then I realized that my build configuration was set to Debug so it was looking for a library called "cbw32d", which I don't have. I changed to Release and it compiles. Now to figure out how to call something in the library.
Thanks for your answers.
You're welcome !
If you only have a release library, remove the line from the pro file that tries to link to the debug version. Doing so you will be able to build your own program in debug mode.
Calling something from the library is the same as calling something from Qt's library. Just include the needed files and call the function. Or is there something more to that lib ?
Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)