PDA

View Full Version : Help converting cmd_line to QTCreator



tob
2nd February 2011, 19:14
Hi,

I am brandy-spanking new to QT (and particularly QT Creator)

I have downloaded the latest, non-beta version of Creator for the Windows environment.

I am attempting to edit, build, and debug a previously written C++ application that targets (an embedded) device running linux.

I did the Creator install and then loaded the (again, previously developed) project file (.pro) --- it loaded wonderfully, all files are visible and it allows me to do some of the neat stuff like switch between the .cpp and .h. So I think the basis for my work is achieved.

Now we get to the trickier part.

The previous owner, developed and built the app on a linux box using typical command prompt mechanisms which include, of course, a Makefile.

And so we finally arrive at my question(s):

1.
I note that Creator uses a 'qmake' of the form:
qmake.exe "C:/my_mainFolder/my_src/uimr.pro" -r -spec win32-g++

and then a call to mingw32-make.exe -w

====> If I want to "reproduce" the output of the command line (MakeFile) mechanisms do I replace one or both of the "standard" build commands above with something that points, instead, to the original MAKEFILE?

2.
The MAKEFILE in question will without doubt have references to places that absolutely will not exist ... say, for example, "/etc" or "/tmp"

====> Is there any help in recreating the "old" MAKEFILE to one that the Windows environment can use to get the same resulting executable?

3.
Is there any manner that allows me to run/debug the output of this build on Windows even though its targeting an embedded linux environment?

Thanks,

ChrisW67
2nd February 2011, 22:55
qmake generates a Makefile to build your project based on the PRO file. It does this to provide a cross platform build system. You might consider creating a PRO file (or set of them) to match the logic of the existing Makefile.

If you want to use an existing Makefile (i.e. no qmake) from a Linux environment then you should import it into Qt Creator as a a generic project: see "Setting Up a Generic Project" in the Qt Creator help.

The likelihood is that the Makefile will try to use commands/place that do not exist in the Windows or Qt bundled minimal MingW environment. You might get lucky and only have to parameterise a few directory names, or you might have wholesale changes to deal with. How you deal with these will be a case-by-case thing.

You can test the existing Makefile (without Qt Creator involved) from the Qt Command Prompt in Windows: cd to your source directory, type mingw32-make, and see how well the build goes.

tob
3rd February 2011, 14:19
Thanks....

I decided to try to go back a a STEP #1 of sorts and just get one or more examples provided in the QT download to build.. which it doesn't :crying:

I am enclosing screenshots of the project IDE with compile output as well as a shot of the build parms page...

It appears to me that there is the classic issue of "decorated" headings versus non-decorated (the "C" vs. "C++" issue with compilers.) I can find no place to indicate (at the GUI Level) how to fix this... and if its an adjustment to the G++ parms or the qMake or the .PRO I have no idea how to do that....

Any help to get an example to build in my windows environment would be greatly appreciated.

thanks,

ChrisW67
3rd February 2011, 23:56
The errors indicate that the linker is not able to find the Qt libraries. Check the Qt Creator settings under Tools, Options, Qt4 to see that Qt 4.7.0 is correctly located (that's what your project is trying to use). Qt 4.7.0 must also have been built using MingW, not MSVC or another compiler.