Der Code scheint sich einwandfrei kompilieren zu lassen, allerdings beim Verknüpfungsschritt Ich erhalte eine undefinierte Referenz:
Code: Select all
/usr/bin/ld: CMakeFiles/GerberStencilGenerator.dir/GerberStencilGenerator_autogen/mocs_compilation.cpp.o: in function `GerberStencilGenerator::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)':
mocs_compilation.cpp:(.text+0xc375): undefined reference to `GerberStencilGenerator::afterWindowIsShown()'
Code: Select all
afterWindowIsShown
Ich gehe davon aus, dass es ein Problem mit der Moc-Kompilierung gibt aber das ist auch schon alles. Ich bin hier völlig verloren.
Das ist meine CMakeLists.txt:
Code: Select all
cmake_minimum_required(VERSION 3.16)
project(GerberStencilGenerator VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
add_definitions(-DQT_NO_KEYWORDS)
list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS "ui" "src")
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Xml)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Widgets)
find_package(PkgConfig REQUIRED)
qt_standard_project_setup()
qt_add_executable(GerberStencilGenerator WIN32 MACOSX_BUNDLE
src/apertureeditview.cpp src/apertureeditview.h
... all the other source files ...
ui/settingsdialog.ui
)
target_include_directories(GerberStencilGenerator PRIVATE
src
ui
)
target_compile_definitions(GerberStencilGenerator PRIVATE
QT_DEPRECATED_WARNINGS
QT_NO_KEYWORDS
)
target_link_libraries(GerberStencilGenerator PRIVATE
Qt::Core
Qt::Gui
Qt::Xml
)
pkg_check_modules(GTK2 REQUIRED gtk+-2.0)
pkg_check_modules(LIBGERBV REQUIRED libgerbv)
pkg_check_modules(CAIRO REQUIRED cairo)
pkg_check_modules(PIXMAN REQUIRED pixman-1)
target_include_directories(GerberStencilGenerator PUBLIC
${GTK2_INCLUDE_DIRS}
${LIBGERBV_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}
${PIXMAN_INCLUDE_DIRS}
)
target_link_libraries(GerberStencilGenerator PUBLIC
${GTK2_LIBRARIES}
${LIBGERBV_LIBRARIES}
${CAIRO_LIBRARIES}
${PIXMAN_LIBRARIES}
)
target_compile_options(GerberStencilGenerator PUBLIC
${GTK2_CFLAGS_OTHER}
${LIBGERBV_CFLAGS_OTHER}
${CAIRO_CFLAGS_OTHER}
${PIXMAN_CFLAGS_OTHER}
)
# Resources:
set_source_files_properties("resources/apertures/circle.svg"
PROPERTIES QT_RESOURCE_ALIAS "circle"
)
... all the other resources ...
)
if((QT_VERSION_MAJOR GREATER 4))
target_link_libraries(GerberStencilGenerator PRIVATE
Qt::Widgets
)
endif()
install(TARGETS GerberStencilGenerator
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
qt_generate_deploy_app_script(
TARGET GerberStencilGenerator
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
Code: Select all
private Q_SLOTS:
void afterWindowIsShown( void );
Jede Hilfe ist sehr willkommen!