私はこのようなCMakeLists設定:GTK +でCMakeListsを設定するには?
project(physiotreapy)
set(HEDEAR_FILES Physiotreapy.h)
set(SOURCE_FILES Physiotreapy.cpp)
add_library(libphysiotreapy STATIC ${SOURCE_FILES})
target_include_directories(libphysiotreapy PUBLIC .)
add_executable(physiotreapy ${SOURCE_FILES} main.cpp)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER})
target_link_libraries(physiotreapy libphysiotreapy)
をしかし、私はこのコードを実行しようとすると:
#include <gtk/gtk.h>
int main (int argc, char *argv[]) {
GtkWidget *okno;
gtk_init(&argc,&argv);
okno = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (okno);
gtk_main();
return 0;
}
私はいくつかのエラーを取得する:
/cygdriveの/ C /ユーザ/はMateusz /デスクトップ/マイプロジェクト/ projects/physiotreapy/main.cpp:11:未定義参照gtk_init_abi_check' /cygdrive/c/Users/Mateusz/Desktop/My project/projects/physiotreapy/main.cpp:11:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
gtk_init_abi_check ' /cygdrive/c/Users/Mateusz/Desktop/My project/projects/physiotreapy/main.cpp:12:未定義の参照gtk_window_new' /cygdrive/c/Users/Mateusz/Desktop/My project/projects/physiotreapy/main.cpp:12:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
90 gtk_window_new ' /cygdrive/c/Users/Mateusz/Desktop/Myプロジェクト/ projects/physiotreapy/main.cpp:13:未定義の参照gtk_widget_show' /cygdrive/c/Users/Mateusz/Desktop/My project/projects/physiotreapy/main.cpp:13:(.text+0x4f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
gtk_widget_show' /cygdrive/c/Users/Mateusz/Desktop/My project/projects /physiotreapy/main.cpp:15:gtk_main' /cygdrive/c/Users/Mateusz/Desktop/My project/projects/physiotreapy/main.cpp:15:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
gtk_mainへの未定義参照
私はCMakeListsに問題があります。 – SpeedClimber
'pkg-config'が' PATH'にあることを確認したら、動作するはずです。 – TingPing