Ghazal Sahebzamani
Ghazal Sahebzamani

Reputation: 145

How do I import my makefile project into QtCreator?

I have previously written a large C++ server and client project (containing multiple .cpp's and .h's which run with makefile). Now I want to modify the client to use a graphical user interface.

Should I import all of my codes to Qtcreator and compile them all in the software? How can I implement the makefile then?

Next, how can I modify my client so that the interfaction with the server is controlled from the graphical interface?

Upvotes: 0

Views: 3612

Answers (2)

AMA
AMA

Reputation: 4214

QtCreator supports working with makefile projects. Basically it becomes a glorified text editor and directly invokes make for your project directory. Some features, like compiling a particular file might not work. See this SO question for more details. And then one can manually link/include Qt for your application's GUI.

Project configuration that is natively supported by QtCreator are qmake files. It converts directly into makefiles. This will provide the best QtCreator experience. So another option would be to convert your makefiles into qmake .pro/.pri files. This will require some effort.

I digress, but if you are going to go this way, I can also recommend CMake. QtCreator has on okay (and constantly improving) support for CMake. So do some other IDEs (CLion, VS). And you will always have the option to convert your CMake files into makefiles, Ninja files, VS solution, or even XCode project.

Upvotes: 0

user4489658
user4489658

Reputation:

Create a Qt project (I guess, you need Qt Widgets application). Copy your existing files into project's directory. Import all these files to your project. Then look what you have to do in main() function. In Qt project it will be in the file main.cpp, and a minimal code for main() will be automatically created by Qt Creator. So, move the necessary code from your main() function there. Then bit by bit look which parts of your code will interact with Qt. Makefile will be created by Qt Creator. Files mainwindow.cpp and mainwindow.h relate to your main window's GUI.

Upvotes: 1

Related Questions