ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Sounlligen's profile - activity

2016-06-17 11:23:50 -0500 received badge  Popular Question (source)
2016-06-17 11:23:50 -0500 received badge  Notable Question (source)
2016-06-17 11:23:50 -0500 received badge  Famous Question (source)
2016-02-09 10:40:00 -0500 asked a question Qt+ROS GUI build error: undefined reference

Hi everyone. I'm using ROS Indigo on Lubuntu Trusty. I'm trying to make a ROS node using Qt GUI. The problem is that when I try to build it, the error occurs:

main.cpp:(.text+0x37): undefined reference to `QApplication::QApplication(int&, char**, int)'
main.cpp:(.text+0x5f): undefined reference to `QApplication::exec()'
main.cpp:(.text+0x7f): undefined reference to `QApplication::~QApplication()'
main.cpp:(.text+0xa9): undefined reference to `QApplication::~QApplication()'
CMakeFiles/setup_node.dir/mainwindow.cpp.o: In function `MainWindow::MainWindow(QWidget*)':
mainwindow.cpp:(.text+0x46): undefined reference to `QMainWindow::QMainWindow(QWidget*, QFlags<Qt::WindowType>)'
mainwindow.cpp:(.text+0x8b): undefined reference to `QPixmap::QPixmap()'
mainwindow.cpp:(.text+0x9e): undefined reference to `QPixmap::QPixmap()'
mainwindow.cpp:(.text+0xb1): undefined reference to `QPixmap::QPixmap()'
mainwindow.cpp:(.text+0xc6): undefined reference to `QPixmap::QPixmap()'

Of course there's much more, but it's just a part of it.

My CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.12)
project(amigo_bot)

set(SOURCES main.cpp mainwindow.cpp painter.cpp information.cpp)

find_package(Qt4 REQUIRED COMPONENTS QtGui QtCore)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES pioneer_escape
#  CATKIN_DEPENDS other_catkin_pkg
#  DEPENDS system_lib
)

include(${QT_USE_FILE})

add_definitions(${Qt4_DEFINITIONS})

include_directories(include 
${catkin_INCLUDE_DIRS}
${Qt_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})

qt4_wrap_ui(UI_SRCS mainwindow.ui)
qt4_wrap_cpp(MOC_SRCS mainwindow.h painter.h information.h)

add_executable(setup_node ${SOURCES} ${UI_SRCS} ${MOC_SRCS})
target_link_libraries(setup_node ${catkin_LIBRARIES} ${Qt_LIBRARIES})

Thank you for your help.