[SOLVED] Simple C++ project build
Sorry for the very basic question... I'm new to QtCreator.
I have an exisiting C++ project. Simply a collection of .cpp and .h files, also I have a classic make file for compilation at the Linux command line using g++...
My question... how do I import these files into QtCreator to create a new project...? This is just a pure vanilla C++ project that runs in the console.
it's easiest to use the wizard to start a new project and add your stuff afterwards.
In the past there was a tutorial in the Qt Creator manual, but I don't see it any more.
Follow these steps :
create a new project > choose a project : other projects, console application.
choose a name for the program and run it to test it out.
Thanks for your response. Sorry about this, but I'm still getting a little confused.
Basically I want to use QtCreator as a basic C++ IDE (like CodeBlocks for example)... at this stage nothing related to Qt.
All the projects I can create seem like Qt projects. The only way I seem to be able to start a project that isn't a Qt project is to 'import existing project'. When I do that, I don't seem to see a project tree in the projects pane, and by the looks of it I have to create my own make file.
I know people have been using QtCreator as a straight C++ IDE... I just can't see how!
If you could clear up any misconceptions I may have, or give me anymore pointers I'd appreciate it.
It's a long time ago I used a console to generate a pro file, so I tried it out again first ;-)
go to your directory where you have your main.cpp, headers and other cpp files.
in a console type :
this wil create a pro file in which links to the headers and source files are made automatically.
use Qt Creator to open the pro file you just generated and you'll see your files in there.
Thanks Eddy. Doesn't seem quite as straightforward as CodeBlocks if I'm honest, but the QtCreator front end is very nice.
Glad you're up and running.
Please edit your first post and add [solved] to it.
One other note...
When you're not going to be using Qt proper in your creator project, be sure and add the line
CONFIG -= QT
to prevent the project from trying to link in the Qt libraries.
bq. Doesn’t seem quite as straightforward as CodeBlocks if I’m honest
This is understandable, as Qt Creator is more specialized toward a certain project perspective (Qt project work) rather than being a general purpose C++ IDE (Though it makes a fine one.) These little caveats are just the price that you pay to step outside the main focus a little bit. I wouldn't worry about it too much, as the benefits of using Creator can easily overshadow the little idiosyncrasies involved with special use cases. :)
thanks for your post. Just so I can this clear... after i've gone to the directory in terminal where my c++ headers and project files are and typed qmake -project I get a ,pro file that I can right click on and open in QtCreator...
after that QtCreator opens and asks me if I want to set up a desktop target. What's that? Just another directory for the debug or release I'm assuming?
Next question... you talk about adding the line CONFIG -= QT but I'm not quite sure where you mean I should be adding that line to?
Thanks for your time
Yes, "qmake -project" will give you a base .pro file. By default it will be named the same as the directory you're currently in. So if you're in a directory called "foo", the project will be "foo.pro". You can rename it of course, if you'd like.
A desktop target just means you're telling Creator that you want to use a build of Qt that's targeted for desktop deployment (as opposed to Symbian or Harmattan for mobile devices.)
You'll want to add the CONFIG -= QT line to your .pro file. It can just be a line by itself in the file somewhere.
There's a lot of good information in the "qmake manual.":http://qt-project.org/doc/qt-4.8/qmake-manual.html#qmake