Results 1 to 7 of 7

Thread: compile plugin with msvc??

  1. #1
    Join Date
    May 2010
    Posts
    9
    Thanks
    1

    Angry compile plugin with msvc??

    hello,

    i want to create a custom widget an use it via drag and drop in qt creator.

    i found out how to create a custom widget and i added the compiled *.dll to the qt creator 4.6.
    but now i have the follwing error in the plugin overview:
    need "windows msvc release full-config" instead of "windows mingw release full-config"
    -> loading has failed!!!!!!!

    i suppose this means the qt creator is built with msvc compiler and is not compatible to the plugin which is - for sure - compiled with mingw.

    how to compile the plugin with msvc compiler or rather Visual Studio????

    Any field reports???

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: compile plugin with msvc??

    1. Install Visual Studio (you can try Express Edition)

    2. Get the Qt libraries for MSVC (there are only for 2008 version) or get the sources and compile Qt from sources with MSVC (that's simple: open MSVC command prompt, get to the dir where you extracted sources - something like qt-everywhere-4.6.2, type:
    Qt Code:
    1. configure
    To copy to clipboard, switch view to plain text mode 
    answer to some questions, wait for a while (half an hour?), after it finished type:
    Qt Code:
    1. nmake
    To copy to clipboard, switch view to plain text mode 
    and wait for a longer while (4 hours?)
    and you have Qt compiled from sources :]

    3. If you have .pro file to your project then you have 2 ways:
    a) open cmd line and type (in dir where your .pro file is):
    Qt Code:
    1. qmake -tp vc
    To copy to clipboard, switch view to plain text mode 
    this will generate .vcproj file - Project file for MSVC - open it and build it.
    b) open visual studio command prompt and type (in dir where your .pro file is):
    Qt Code:
    1. qmake CONFIG+=release
    2. nmake
    To copy to clipboard, switch view to plain text mode 

    Both options will work only if you have Qt Libriaries compiled with MSVC and PATH points to qmake from this version of Qt (with spec set accordingly to your MSVC version, if not then you have to use -spec switch in qmake calls - check it in Qt Assistant).
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. The following user says thank you to faldzip for this useful post:

    tentakel (4th May 2010)

  4. #3
    Join Date
    May 2010
    Posts
    9
    Thanks
    1

    Wink Re: compile plugin with msvc??

    many thanks to faldżip,

    now i have got an idea what to do.

    ......but my first try doesn't work.
    so one more question.

    i installed the vs2008 and the qt libraries for vs2008.

    now i want to process step 3.

    In 3a:
    it says:
    Warning: No Resources in 'icons.qrc'

    In 3b:
    It says:
    NMAKE : fatal error U1073: "../../../Programme/Qt/2010.02.1/qt/mkspecs/win32-g++
    /qmake.conf" konnte nicht erstellt werden (----->not built)
    Stop.

    what do you mean with:
    Both options will work only if you have Qt Libriaries compiled with MSVC and PATH points to qmake from this version of Qt (with spec set accordingly to your MSVC version, if not then you have to use -spec switch in qmake calls - check it in Qt Assistant).


    Any ideas??????

  5. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: compile plugin with msvc??

    Since you've installed Qt for VS2008 you have now 2 different Qt Libraries in your system - for MinGW (installed with Qt Creator previously) and for VS2008.
    Now, when you type qmake which qmake is used? As I see in
    [quote]
    NMAKE : fatal error U1073: "../../../Programme/Qt/2010.02.1/qt/mkspecs/win32-g++
    /qmake.conf" konnte nicht erstellt werden (----->not built)
    [/qmake]
    it is your MinGW qmake. Type the full path to the right qmake.exe (where you have installed Qt for VS2008). Or check PATH environment variable and set remove path to MinGW Qt installation. Or just uninstall Qt SDK (as I assume that's what you have installed first) and install standalone Qt Creator - it will then use your VS compiler (MSVC).
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  6. #5
    Join Date
    May 2010
    Posts
    9
    Thanks
    1

    Default Re: compile plugin with msvc??

    hello faldżip ,

    i am on a different system without the previously installed qt creator. i have only installed vc2008 and the qt libarries for vc2008.



    by the way:
    some notes to 3a:
    Warning: No Resources in 'icons.qrc'

    i added all the files which are created by the qt creator to the qrc file.
    <RCC>
    <qresource prefix="/">
    <file>ui_testcustom.h</file>
    <file>icons.qrc</file>
    <file>Makefile</file>
    <file>Makefile.Debug</file>
    <file>Makefile.Release</file>
    <file>testcustom.cpp</file>
    <file>testcustom.h</file>
    <file>testcustom.pri</file>
    <file>TestCustom.pro</file>
    <file>TestCustom.pro.user</file>
    <file>testcustom.ui</file>
    <file>testcustomplugin.cpp</file>
    <file>testcustomplugin.h</file>
    </qresource>
    </RCC>

    and executed in cmd: qmake -tp vc
    this is now succesful and the VC++ Project File is generated.

    after opening the vc++ project file, the vc++ project opens in VC2008,
    but,...............the project in vc++ lists additionally the following files moc_testcustom.cpp, moc_testcustompluginand.cpp qrc_icons.cpp.
    these files are not generated by qmake -tp vc.

    i deleted all the moc_XXX and qrc_XXX files in the project.
    compiling the vc++ project fails with "fatal error C1083: Datei (Include) kann nicht geöffnet werden: (--> could not open include file) "QDesignerCustomWidgetInterface": No such file or directory"
    perhaps the qt library is not part of VC2008.

    so, any ideas????
    Last edited by tentakel; 4th May 2010 at 15:44.

  7. #6
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: compile plugin with msvc??

    Quote Originally Posted by tentakel View Post
    hello faldżip ,

    i am on a different system without the previously installed qt creator. i have only installed vc2008 and the qt libarries for vc2008.



    by the way:
    some notes to 3a:
    Warning: No Resources in 'icons.qrc'

    i added all the files which are created by the qt creator to the qrc file.
    <RCC>
    <qresource prefix="/">
    <file>ui_testcustom.h</file>
    <file>icons.qrc</file>
    <file>Makefile</file>
    <file>Makefile.Debug</file>
    <file>Makefile.Release</file>
    <file>testcustom.cpp</file>
    <file>testcustom.h</file>
    <file>testcustom.pri</file>
    <file>TestCustom.pro</file>
    <file>TestCustom.pro.user</file>
    <file>testcustom.ui</file>
    <file>testcustomplugin.cpp</file>
    <file>testcustomplugin.h</file>
    </qresource>
    </RCC>
    delete this icons.qrc file. As I can see you don't need this at all.

    and executed in cmd: qmake -tp vc
    this is now succesful and the VC++ Project File is generated.

    after opening the vc++ project file, the vc++ project opens in VC2008,
    but,...............the project in vc++ lists additionally the following files moc_testcustom.cpp, moc_testcustompluginand.cpp qrc_icons.cpp.
    these files are not generated by qmake -tp vc.

    i deleted all the moc_XXX and qrc_XXX files in the project.
    compiling the vc++ project fails with "fatal error C1083: Datei (Include) kann nicht geöffnet werden: (--> could not open include file) "QDesignerCustomWidgetInterface": No such file or directory"
    perhaps the qt library is not part of VC2008.

    so, any ideas????
    Do you have "CONFIG += designer plugin" in your .pro file (read Custom Widget Plugin Example in Qt Assistant)? Do you have QTDIR envirnoment variable set? Check if Qt include paths and libs are set in Visual Studio project properties.

    moc_xxx files are generated by MOC - meta-object compiler - tool which is a part of Qt.

    But surely your previous error from 3b. was cause by wrong mkspec. Remove all files which are not needed (left only .h .cpp .pro) and rerun qmake. If the error still exists delete Makefiles and type:
    Qt Code:
    1. qmake -spec win32-msvc2008
    To copy to clipboard, switch view to plain text mode 
    And I've already told you to read about spec (QMAKESPEC) in Qt Assistant. If you would read it then you would know that this:
    .../qt/mkspecs/win32-g++/...
    is used with MinGW under Windows.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  8. #7
    Join Date
    May 2010
    Posts
    9
    Thanks
    1

    Default Re: compile plugin with msvc??

    hello faldżip,

    let me first say "thank you for your help", so far.
    unfortunately i have several problems generating the plugin.

    but let me first tell you my proceeding:
    1. deleted all makefiles.
    2. opened qt prompt
    3. in project folder: qmake -spec win32-msvc2008 (now i have new makefiles with the correct path to qt and msvc)
    4. qmake -tp vc (generating vcproj)

    5. qmake CONFIG+=release
    6. nmake
    or
    5. open vcproj file & compile release version

    the plugin *.dll is generated without any errors. therefore all neccessary files were generated (moc_, ...)

    then..........

    A. switching the system (another pc) to the qt sdk
    B. adding the *.dll to qt designer
    C. the custom widget appears and can be placed
    D. on the form only a rectangle appears as custom widget without buttons placed as before
    E. try to build it: error: qt wants the mycustom.cpp and mycustom.h file of the custom plugin in its project folder
    F. i copy the cpp and h file of the custom plugin in the project folder
    G. start Building with my custom widget "MyCustom" ---------error--------->
    - C:/............../ui_mainwindow.h:43: undefined reference to `MyCustom::MyCustom(QWidget*)'
    - :-1: error: collect2: ld returned 1 exit status

    do you think my makefiles are still buggy????

    i suppose the *.dll refers to the qt library of the second system.
    or am i doing sth else wrong???

Similar Threads

  1. Problem with compiling Qt 4.6 via MSVC 2010 Beta2 (win32-msvc specs)
    By Erik-Moscow in forum Installation and Deployment
    Replies: 2
    Last Post: 17th December 2009, 18:44
  2. Possible to compile Qt 4.5 source with msvc 2010 beta?
    By JimDaniel in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd July 2009, 14:19
  3. QMYSQL Plugin does not compile
    By mmaayeh in forum Qt Tools
    Replies: 1
    Last Post: 24th April 2009, 07:43
  4. how to compile with msvc express 2008
    By john_god in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd March 2009, 14:09
  5. Qt plugin compile once
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 00:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.