Qt World Summit: Submit your Presentation

Switch MinGW 64bits to MSVC 2013

  • Hi,
    I would pass my project to MSVC 2013.

    But I have some trouble with my libs.

    I don't understand who manage it.

    Before with MinGW used .dll.

    Now when I compile my lib under MSVC i have (.dll, .lib, .obj, .exp)

    when I use this lib , the linker say :-1: erreur : LNK1181: impossible d'ouvrir le fichier en entrée 'liba.lib'

    in my .pro I have :

    win32: LIBS += -L$$PWD/ -llibA


    I don't know how use libraries with MSVC, someone can help me ?

  • You are aware that you cannot mix libs compiled with MinGW and MSVC?
    If you simply switched the tool chain from MinGW to MSVC this looks like you have still some old remains in the folders. I suggest to have completely separated folders for each compilation.
    Most likely the poblem stems from

    win32: LIBS += -L$$PWD/ -llibA

  • it's ok I didn't know that MSVC need *.dll AND !!! *.lib to build but not needed for deployment.

    My proble now is :

    moc_structure.obj:-1: erreur : LNK2001: symbole externe non résolu "public: static struct QMetaObject const QCustomPlot::staticMetaObject" (?staticMetaObject@QCustomPlot@@2UQMetaObject@@B)

    I have build and other project with QCustomPlot and all is good.

    in my file structure i derivate QCustomPlotm like this :

    class CustomPlot : public QCustomPlot
        CustomPlot(QWidget *parent = 0);
        bool event(QEvent* event);
        bool _release2touch;
        bool _touchDevice;

    Where come from this error ?

  • Lifetime Qt Champion

  • Quote from the 5.4 docs:
    <<For new code we suggest using Qt WebEngine, but it makes sense to continue using Qt WebKit for applications that are in need of a deeper C++ API than having better and up-to-date support for HTML, CSS and JavaScript features.>>

  • For solved this proble I commit the Q_OBJECT and all my project build and link but crash at start.

    It's very complicated to used MSVC.

    With Qt creator I start a small project using lib and it works but with Visual Studio 2013 with plugin Qt it say:
    The procedure entry point is not found in the dynamic link library ...

    Someone have a Qt project which works under Visual Stidio ?

  • Coming to your initial issue it should be easy to compile an application one time with MinGW setup and another time with MSVC. The differences are basically the tool chains to be used for each compilation. It is the same as switching between different Qt kit versions under "Proejcts"->"Build&run"

    I would recommend that you are starting with a simple hello world program for seeing and checking that the overall process works as you expect. The next step is on my opinion to use one of the supplied Qt examples which may be compiled using different tool chains.

    After this you may want to start with your library. For every dll you need to have a small lib with the stubbs defining basically the interface for your application to the dlls. That makes it a bit confusing.

    As already described above with your own library (independent of static or dynamic) you typically face the issue that you want to store the compilation of your library for easier access with other applications. Since there is always an issue with different compilers which are not compatible in their interfaces, you have to be careful in seaparating the different bits. What you are using in your path for the lib $PWD is basically the default path of your project. When you switch between different tool chains you shave to assure that there are no left-overs from previous compilations.

Log in to reply