.hpp header files not shown in projects view
-
Hi and welcome to devnet,
The first thing would be to update Qt Creator to a more recent version. 7 is really outdated.
-
@SGaist Thank you for the reply. The reason why I am using this version is because I am developing on Linux (Ubuntu 20.04 LTS). The most recent versions of qt creator have a really annoying bug; when you run the a cpp target whether it's set to "run in terminal" or not, it freezes. you have to wait for like 5 secs or more before qt creator responds again.
In either way, the I tried the latest version, and it didn't show the ".hpp" files also. -
I just tested with Qt Creator 11.0.3 on macOS and the
.hpp
headers are properly shown.Might be a silly question but did you also update the
CMakeLists.txt
file after renaming the header file ? -
@SGaist Actually it works in qt creator 11.0.3 on ubuntu 20.04 LTS. But I wonder Should I add the header files one by one in cmakelists.txt?
for example, this doesn't work.:
set(INC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(${PROJECT_NAME} ${SOURCES} ${INC_DIRS})
but this works:
set (HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/test.hpp) add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
-
Christian Ehrlicher Lifetime Qt Championreplied to Omar Hatem on last edited by Christian Ehrlicher
@Omar-Hatem because add_executable() takes a list of source/header files, not directories as described in the documentation.
Should I add the header files one by one in cmakelists.txt?
Yes, the same goes for every source file.
-
@Christian-Ehrlicher So, I must add the header to the
add_executable
fucntion in order to work? otherwisetarget_include_directories
won't suffice to view the header files under theheaders
files filter in the project view? -
Correct. It would be very cumbersome if all headers from include_directories() would be shown there...
-
@Christian-Ehrlicher @SGaist Thank you guys!
-
-
@Christian-Ehrlicher I have a question please, just to make sure, is including the header files in
add_executable
function makes extra overhead during compilation? -
@Omar-Hatem No