Important: Please read the Qt Code of Conduct -

Adding External library

  • I am trying to add an external library to a project and I can't figure out how to make it complete.

    I used the right mouse click Add Library dialog and it added the following into my .pro file :

    win32: LIBS += -L$$PWD/../../../Desktop/CcmAccess/ -lCcmApi

    INCLUDEPATH += $$PWD/../../../Desktop/CcmAccess
    DEPENDPATH += $$PWD/../../../Desktop/CcmAccess

    I add the header file into the main.cpp file and when I try to build it the message is:

    undefined reference to 'CcmOpen@0'

  • I think one aspect of the problem is that the external library is 64bit and Qt and the version of MinGW that is installed is 32 bit. I can't find a distribution of Qt and MinGW that is 64bit for windows. All of the 64bit versions for Windows expect Visual Studio, argh, and I don't have Visual Studio. I do have 64 bit MinGW that I use with eclipse

    Can I install the Visual Studio version of Qt and ditch the Visual Studio kit and replace it with a 64 bit version?

  • Moderators

    Is CcmAccess a library built with mingw? If it is built with another compiler, it won't work. I've seen people try to mix MSVC and mingw libs before and it does that exact behavior.

    However, if it's ok and you are just mixing 64 and 32 bit, that won't work either. AFAIK you can't just replace the "kit" in an MSVC install. That leaves you with either getting a 32-bit version of CcmAccess or building Qt for 64-bit.

    I have built mingw and qt 64-bit before (like 5.0 I think). It is not fun or easy. There are almost always problems. You may get lucky with the current Qt but I doubt it. That being said I was able to work around or fix all the problems and got it to build.

    And finally, a horrible solution IMO, you can get MSVC for free. They have a free version that is plenty to compile and run Qt apps with. Especially since you won't even be using the IDE as you use eclipse. I hate MS technologies and only use them when I have to. Your better off just getting a 64-bit qt build with mingw. :)

    I'd be happy to help you through any build issues you might have. Good luck!

  • CcmAccess is built with MSVC, and the Qt that I use is MinGW. I will give it some thought, I am not a windows user, I use linux whenever I can. This is for a piece of technology that only runs on windows, uses a service to get the data from a USB port. Thanks for your help.

  • Moderators

    Yea that is your problem then. I kind of wish mingw would put out a warning or something when mixing libs like that but it just ignores it when it's not in the right format.

    I too am a linux user so 99% of my development time is linux and osx. Windows always causes me problems just like this which is how I knew that problem, lol.

    If you have to use that lib you are going to have to use MSVC to compile or get the source for that lib and build it with mingw.

  • If I downloat the qT msvc 64 bit version, I don't actually have to own a licence for the MSVC, it just downloads with the free stuff?

  • Moderators

    No it doesn't download for you, at least I don't think it does. I always build Qt myself.

    Anyway, you will probably need to get a copy of it. You do not need to buy it though. You will need a license but you just get that automatically on install with a valid email address.

    You can download Visual Studio Express from "here": .

    Express is the free version. Be careful when you download and read everything. Like most things they try to trick you into the professional version trial so you then think you have to buy it later. Just make sure you stick with "express" not "pro" and the free option during the download process and you should be good to go. Sorry you have to work with MSVC. ;)

Log in to reply