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

Revision history [back]

click to hide/show revision 1
initial version

The problem is NOT from QT-creator or ROS, but from your CMakeLists.txt, where QT-Creator will read through to decide what to include and then you can get auto-completion.

Quickly Google" How to add files to CMAKEList", I find 2 useful links

https://cmake.org/cmake-tutorial/ (read Step1 and Step2 is enough to move on).

Another specific example is the answer of Angrew, from this link http://stackoverflow.com/questions/13703647/how-to-properly-add-include-directories-with-cmake

Here is my example, I have 2 files:

include/my_package/my_code.h

src/my_code.cpp

If I want to create a executable file from these file, and include them in QT-Creator, add these lines to CMakeLists.txt

add_executable(my_node_executable include/my_package/my_code.h src/my_code.cpp )

but, If I want to create a library to be used by other node, add:

add_library(my_node_executable include/my_package/my_code.h src/my_code.cpp )

Hope this helps.

The problem is NOT from QT-creator or ROS, but from your CMakeLists.txt, where QT-Creator will read through to decide what to include and then you can get auto-completion.

Quickly Google" How to add files to CMAKEList", I find 2 useful links

https://cmake.org/cmake-tutorial/ (read Step1 and Step2 is enough to move on).

Another specific example is the answer of Angrew, from this link http://stackoverflow.com/questions/13703647/how-to-properly-add-include-directories-with-cmake

Here is my example, I have 2 files:

include/my_package/my_code.h

src/my_code.cpp

If I want to create a executable file from these file, and include them in QT-Creator, add these lines to CMakeLists.txt

add_executable(my_node_executable 
                         include/my_package/my_code.h 
                         src/my_code.cpp
)

)

but, If I want to create a library to be used by other node, add:

add_library(my_node_executable 
                         include/my_package/my_code.h 
                         src/my_code.cpp
)

)

Hope this helps.