header file not found
-
Hello,
I was trying to compile the"" https://github.com/KDABLabs/kdabtv/tree/master/Qt-Widgets-and-more/WidgetPromotion "" using Cmake but i am getting following error:Debug/qtDesignerPlugins_autogen/include/ui_ImageViewer.h</a>:16:10: fatal error: FileSelector.h: No such file or directory
16 | #include "FileSelector.h"
| ^~~~~~~~~~~~~~~~can anyone please tell me what could have gone wrong?
Thanks
-
@slackuj
I am not an expert (and never used cmake).FileSelector.h
should be in your original sources directory (it is there, isn't it? And if you are under Linux then it must have those capital letters), theui_...h
is in someautogen
area. Is that supposed to be the case? Do you need to add your source directory to the "include directories" of cmake, so that it passes-I...
for that to the compiler invocation? -
@slackuj said in header file not found:
can anyone please tell me what could have gone wrong?
Since you did not post your CMakeLists.txt I would guess you forgot to add the current source directory to the include directories.
-
@Christian-Ehrlicher should i call --- target_include_directories(businesslogic INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) ?
How should i call it?
my CmakeLists.txt file is:
cmake_minimum_required(VERSION 3.5)
project(qtDesignerPlugins VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)set(PROJECT_SOURCES
main.cpp
ImageViewer.cpp
FileSelector.cpp
FileSelector.h
ImageViewer.h
ImageViewer.ui)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(qtDesignerPlugins
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)Define target properties for Android with Qt 6 as:
set_property(TARGET qtDesignerPlugins APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/android)
For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(qtDesignerPlugins SHARED
${PROJECT_SOURCES}
)Define properties for Android with Qt 5 after find_package() calls as:
set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else() add_executable(qtDesignerPlugins ${PROJECT_SOURCES} FileSelector.h FileSelector.cpp ImageViewer.h ImageViewer.cpp ImageViewer.ui ) endif()
endif()
target_link_libraries(qtDesignerPlugins PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
If you are developing for iOS or macOS you should consider setting an
explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.qtDesignerPlugins)
endif()
set_target_properties(qtDesignerPlugins PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)include(GNUInstallDirs)
install(TARGETS qtDesignerPlugins
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(qtDesignerPlugins)
endif() -
@slackuj please use code tags to format your file. I can not read anything and already told you what is missing.
-
@Christian-Ehrlicher
I am sorry, but could you please tell me how to use the code tag?I am sorry again, I am just a newbie.
-