PDA

View Full Version : Using the Makefile, Project, and Workspace Creator (MPC) with UIC Files



kwaller
10th July 2006, 13:46
I am trying to use the Makefile, Project, and Workspace Creator (MPC) tool to create a Visual C++ Project (7.1) file that can compile UIC files. I use the default base project file provided by MPC to achieve this (qt.mpb). The problem is, when I create the Visual C++ project file, load it into the Visual C++ environment, and click the 'Build' command, the build fails because the CPP file that UIC creates does not get compiled, and therefore the link step fails (because there is no object file).

Here is a detailed example:

At first, I have two files: main.cpp and options.ui.

I then use the following MPC file to create the Visual C++ project file:

project: qt {

UIC_Files {
options.ui
}

MOC_Files {
options.h
}

Source_Files {
main.cpp
options.cpp
options_moc.cpp
}

}

Here is the output from the Visual C++ build step:

Invoking C:\Qt\3.3.5\bin\uic on options.ui
Invoking C:\Qt\3.3.5\bin\moc on uic_generated\options.h
Compiling...
options_moc.cpp
main.cpp
Generating Code...
Linking...
LINK : fatal error LNK1104: cannot open file '.\Debug\MPC_Qt_Proj\options.obj'

As you can see, options.cpp was not compiled (and therefore options.obj was never created and the link step fails). I believe the reason that options.cpp was not compiled is because that file is not listed as an output of the Custom Build Step of the UIC file.

If anyone else has run across this problem and know some fixes, I would be very appreciative.

Thank you in advance for your help.

zlatko
11th July 2006, 09:07
I think its "PATH" related problem..your path to *.obj is incorect...Also IMHO its strange way to build qt project with Visual Studio...Have you install QMSNet2003 ?

kwaller
11th July 2006, 14:19
I don't think it's a PATH related problem, because the linker is able to find the other *.obj files that are created by the compiler. Also, upon inspection of the folder where all *.obj files reside, there is not one for options.obj (while there are *.obj files for main.cpp and options_moc.cpp (i.e. main.obj and options_moc.obj)).

Furthermore, using the 'Rebuild' command (instead of 'Build') causes the program to be built correctly.

The reason we are using MPC (as opposed to QMake) is because we have a need to integrate IDL files (CORBA) into our application, thus we need to specify the Custom Build Steps for the IDL files, which MPC can do quit easily. As far as I can tell, you cannot specify to QMake how to create Custom Build Steps for other types of files, such as IDL files.