Qt Development on Linux Using Eclipse

qt development on linux using eclipse?

How I do Linux + eclipse + Qt + CMake.

The good thing about it that the sources just use CMake, they are built like if it was just a plain CMake project. And you don't pollute them with the eclipse stuff: the eclipse workspace and project files are outside.

Qt

  • Get latest eclipse and then install the Qt package in it through "Help -> Install New Software".

  • Create an empty "workspace" directory outside the CMake project source directory.

  • Launch eclipse and switch to that "workspace" directory.

  • Create a C++ -> Makefile Project -> Qt Makefile Project.

  • Delete *.pro file, makefile and main.cpp from it.

Sources

  • Go to Project Properties -> Paths and Symbols -> Source Location -> Link Folder.

  • Check "Advanced" and link the source folder of CMake project like that: ../../myproject/. It works because the workspace is just outside the CMake project directory.

CMake generator

  • Create Release folder in the project.

  • Go to "Make Target" view (Ctrl+3 and then type "Make Target" if it's hard to find). "Make Target" view looks just like the project view.

  • Right click on the "Release" folder and "New...".

  • Uncheck "Same as target name", uncheck "Use builder settings".

  • Type in "Release" into "Target name" field, leave "Make target" empty, "Build command" is something like "cmake ../../../myproject/". Click ok.

  • Double click on this "Release" make target that was just created in the Release folder. It should run cmake.

Build

  • Go to Project Properties, create "Release" configuration.

  • Make "Release" configuration active.

  • For "Release" configuration uncheck "Generate Makefiles automatically".

  • Set Build directory to "Release".

  • Enable parallel build.

It should build now in "Release" directory. If it doesn't, remove all from the "Release" directory and rerun cmake by double-clicking on "Release" target in the "Make Target" view as before.

The template for a CMakeLists.txt that I use: https://stackoverflow.com/a/36181462/4742108

CMakeLists editing is done by hand. So you can collaborate with anyone, because to build the software they only need the source files and CMakeLists.txt. (CMake is one of the most wide-spread C++ build systems)

UI designer in eclipse CDT

I advise you to install QtSDK which includes QtCreator, designer, assistant, linguist ..etc.
You can create your new Qt project with QtCreator which creates the .pro file and form files. You can design your .ui(form) files with designer and then open your project as a Makefile project in Eclipse CDT which is a better IDE than QtCreator.

http://qt.digia.com/Product/Qt-SDK/

Qt resource editor on eclipse

right click on project -> New -> Other -> Qt -> Qt resource file.
Then double click on the file just created..

Eclipse, QT and C++ project : is it possible?

Doing this is quite bothering, I suggest you don't do it. I've tried it only on small projects.

As far as I know you'll have to write a correct Makefile yourself (or setup CDT to create it) by including all the include paths you need for Qt headers. Then you'll have to link to all the Qt libraries your project is using.

If you make use of the Qt meta-object system you'll have to run the moc before compiling and linking. The moc generates C++ sources that you'll have to link to the other sources. If you're using GNU make, and I guess you are, it seems to be possible to automate the moc writing the correct instructions in the Makefile CDT will create. For detailed information read this: http://doc.qt.io/qt-5/moc.html#writing-make-rules-for-invoking.

By the way, isn't it possible for you to use Qt Creator?

Is the Qt Eclipse integration plugin still available for download?

Work was stopped on it a long time ago, and when Qt became open-source it had become so out of date it was removed from the downloads page. The Windows version is still available at Softpedia though.

I must say, if I were you, I would use Qt Creator. Development on it has accelerated in the last couple of years and it is much better than Eclipse for Qt work (I actually prefer it for general C++ work as well).



Related Topics



Leave a reply



Submit