Results 1 to 3 of 3

Thread: [Solved] Using RCC and UIC as standalone tools?

  1. #1
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [Solved] Using RCC and UIC as standalone tools?

    Hello,

    I have been working on setting up QT on a windows environement (MS Visual Studio .net 2003, QT 4.2.3 OpenSource ed.), and i'm ending with an issue i would like to understand.
    I have been using QT on linux for some monthes, and i didnt have to bother this problem since i was using the makefiles generated by QMake, now i am using the an intel compiler integrated within Visual Studio... All this set up has been mainly made to make sure QT perfectly suits for the application we want to make (We want a photoshop plugin, so i have to make sure i can workaround the QApplication issue on Non-QT app calling a QT based DLL "plugin")...

    Here is what i have done so far:
    - Compiled a version of QT so it i can compile project with the MS / Intel compiler (NMake as the main compiler command).
    - Set up a very minimalistic pre-build batch which does basically a RCC on needed pictures files, and UIC on GUI files.
    - When i start the build in VS, the batch file is started, so the ui_*.cpp and res_*.cpp get generated.
    Note that the MS VS project is *not* a Makefile project, it is a basic .vsproj with compiler options set in the VC project.

    However, i am now unable to use the compiled pictures in my binary, i get this error at compile time:
    CWndMainImpl.obj error LNK2005: "int __cdecl qCleanupResources(void)" (?qCleanupResources@@YAHXZ) already defined in PluginMain.obj
    CWndMainImpl.obj error LNK2005: "int __cdecl qInitResources(void)" (?qInitResources@@YAHXZ) already defined in PluginMain.obj
    CWndMainImpl.obj error LNK2005: "class qCleanupResources__dest_class__ qCleanupResources__dest_instance__" (?qCleanupResources__dest_instance__@@3VqCleanupRe sources__dest_class__@@A) already defined in PluginMain.obj
    So, i have tried to go in my "precompiled" resources .h file, and remove those 3 static methods, it finally compiles but the program is then unable to retrieve the pictures data (No error, just no pictures).

    I am sort of disapointed, because i was really pleased using QT on my usual linux environement, and i feel pretty uncomfortable under windows anyway... But for some reason, i cant switch back to Linux unless i have done a "compilable" project for windows, some of my coworkers will need it...

    Any kind of help will be greatly appreciated

    Pierre.
    Last edited by hickscorp; 28th March 2007 at 23:17. Reason: Solved :)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using RCC and UIC as standalone tools?

    Why don't you use "qmake -tp vc" to generate a Visual Studio project?

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

    hickscorp (28th March 2007)

  4. #3
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using RCC and UIC as standalone tools?

    Hello Wysota,

    Since the project for making the photoshop plugin is very complex (Mostly precompiler directives and linker stuff), i used your advice and generated a project "just to see".

    I ended with a clean project (Not compilable because of the photoshop requirement in VC project), with inside all my ressources included in the main "view". The only difference i have with my project is, that the qmake generated project doesnt use any external batch for "precompiling" the QT resources, it is set up on each file directly in the project.

    So i have done the following:
    - Removed my batch file from pre build step, and just copy-pasted the custom build step assignated on my .ui and .qrc files from the qmake generated project to my project.
    - Compiled, it actually does compile without any error.
    With this, i ended with my original photoshop project, set up identically as shown in the QMake generated one...
    But now, i end exactly as before when i tested deleting the 3 static methods: The program is running, but no picture is shown (The main .ui is supposed to be showing 5 little icons, i see them in QTDesigner).

    What may i be doing wrong here? oO
    Thanks anyway, i feel i'm going forward

    Pierre.

    [EDIT]: I may have a guess on why is going on:
    1) After RCC runs, a file named qrc_Pictures.cpp is generated. This file is not included anywhere on my source tree. So i just tried to include it, and i get the same error as i had (Linker error about the 4 static methods already defined).
    2) Maybe the generated ui_WndMain.h isnt calling the resources the right way (Maybe a path problem in the resource file?), so is there a way to list the QT resources which are present in my binary when it's runing?

    [EDIT2]: i confirm, the resources are not included in my binary, it's size with or without it is the same. So my final question will probably be: where am i supposed to include the file qrc_Pictures.cpp from my code, without getting the errors i described in my first post?

    [EDIT3]: Sorry for the edition count, i just got the pictures shown on the program. The only difference with the previous was, i included the qrc_Pictures.cpp file from my my "top-level" code file (Like main.cpp), instead of including it from a file named CWndMainImpl.h which is implementing a ui generated class...
    So i just set up my project as it was before (With my batch file for RCC & UIC), and it works ^^

    Thanks a lot for the clues which permited to solve this

    Pierre.
    Last edited by hickscorp; 28th March 2007 at 23:00.

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
  •  
Qt is a trademark of The Qt Company.