0

I've installed nokia qt plugin

Qt C++ Eclipse Integration
Version: 1.6.1

but it's not working in Eclipse MARS 2 (4.5.2). I also installed qt 5.6.

So i need to somehow configure my cdt project to see qt libraries. To make

#include <QApplication>

work and also to make the project to successfully build.

How to do that?

I've tried to add C:\Qt\5.6\mingw49_32\include to project include directories but

#include <QApplication>

not working.

I cannot work with imported Makefile project for qmake generated Makefile, because for each .o file entry it contains

release/EntryPoint.o: EntryPoint.cpp bios/Bios.hpp \
...
        ../../../../Qt/5.6/mingw49_32/include/QtWidgets/QLabel \
        ../../../../Qt/5.6/mingw49_32/include/QtWidgets/qlabel.h \
... 100 of lines here

This 100 of lines won't appear without external hepl for each added cpp file in project. Importing Makefile to eclipse provides project with not working includes.

Is there a way to make qt work with any version of eclipse?

Vyacheslav
  • 3,134
  • 8
  • 28
  • 42
  • Use Qt Creator or Visual Studio with Qt: http://stackoverflow.com/questions/32894097/how-do-i-use-qt-in-my-visual-studio-2015-projects Eclipse is just bad and bad with Qt for no reason when we have better. – Alexander V May 30 '16 at 15:02

1 Answers1

0

Using cmake solves your problem with creating the projects you need. That should not matter if you are using *nix Makefiles, nmake, visual studio or whatever.

Edit: I just checked if it is working with CMake. Installing Qt 5.6 mingw49 and Eclipse 4.5.2. After creating the project with cmake 3.5.1 I imported it and it just compiles fine! There is a problem with the Path variable but copying the exe to the bin folder of Qt is working (do not have time to check what is the problem).

Here is a starting point of cmake and Qt:

PROJECT(minimal)
add_definitions(-DUSE_QT)
set (CMAKE_PREFIX_PATH "C://Qt//5.6//mingw49_32")

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)

INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

FILE(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
FILE(GLOB CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
FILE(GLOB UI_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.ui")
FILE(GLOB RC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.qrc")


QT5_ADD_RESOURCES(ENTITY_DEBUGGER_RC_SRCS ${RC_FILES} )

QT5_WRAP_UI( ENTITY_DEBUGGER_UI_HDRS ${UI_FILES})

ADD_EXECUTABLE( minimal 
            ${CPP_FILES}
            ${ENTITY_DEBUGGER_RC_SRCS} 
            ${ENTITY_DEBUGGER_UI_HDRS} 
            ${HEADER_FILES} 
            )

SET_TARGET_PROPERTIES(minimal PROPERTIES DEBUG_POSTFIX _d)


qt5_use_modules(minimal Widgets Core)


INSTALL(TARGETS minimal
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  )

PS: I strongly agree that Eclipse is not the best IDE. There are some other free IDEs (VS, QtCreator, Sublime, Codeblocks, ...)

akira hinoshiro
  • 393
  • 2
  • 15