Skip to content

Instantly share code, notes, and snippets.

@niwaniwa
Last active November 29, 2022 07:01
Show Gist options
  • Save niwaniwa/24923cec95013ad3e2c2f7365cadb2e2 to your computer and use it in GitHub Desktop.
Save niwaniwa/24923cec95013ad3e2c2f7365cadb2e2 to your computer and use it in GitHub Desktop.
C++なんもわからん
cmake_minimum_required(VERSION 3.23)
project(MyTest C CXX)
set(CMAKE_CXX_STANDARD 17)
#ADD_SUBDIRECTORY(include)
get_filename_component(lib_absolute "include/AService/caio.lib" ABSOLUTE)
add_library(CaioLib SHARED IMPORTED)
set_target_properties(CaioLib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${lib_folder_absolute}")
set_target_properties(CaioLib PROPERTIES IMPORTED_IMPLIB "${lib_absolute}")
#set_target_properties(CaioLib PROPERTIES INTERFACE_COMPILE_DEFINITIONS SK_GL)
#set_target_properties(CaioLib PROPERTIES ENABLE_EXPORTS 1)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC CaioLib)
add_subdirectory(AService)
message("Add Library")
add_library(caio INTERFACE)
target_include_directories(caio INTERFACE .)
====================[ ビルド | MyTest | Debug ]================================
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\cmake\win\bin\cmake.exe --build E:\Users\...\MPHTS\MyTest\cmake-build-debug --target ContecTest -j 9
[1/1] Linking CXX executable MyTest.exe
FAILED: MyTest.exe
cmd.exe /C "cd . && C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin\g++.exe -g CMakeFiles/MyTest.dir/main.cpp.obj -o MyTest.exe -Wl,--out-implib,libMyTest.dll.a -Wl,--major-image-version,0,--minor-image-version,0 ../include/contec/caio.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: CMakeFiles/MyTest.dir/main.cpp.obj:E:/Users/.../MPHTS/MyTest/main.cpp:50: undefined reference to `AioInit'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: CMakeFiles/MyTest.dir/main.cpp.obj: in function `main':
E:/Users/.../MPHTS/MyTest/main.cpp:52: undefined reference to `AioGetErrorString'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:61: undefined reference to `AioSetAiInputMethod'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:63: undefined reference to `AioGetErrorString'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:66: undefined reference to `AioExit'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:74: undefined reference to `AioSetAiRangeAll'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:76: undefined reference to `AioGetErrorString'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:79: undefined reference to `AioExit'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:87: undefined reference to `AioSingleAi'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:89: undefined reference to `AioGetErrorString'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:92: undefined reference to `AioExit'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:102: undefined reference to `AioExit'
C:\Users\...\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\222.4345.21\bin\mingw\bin/ld.exe: E:/Users/.../MPHTS/MyTest/main.cpp:104: undefined reference to `AioGetErrorString'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
/-
| CMakeList.txt --- 1
| main.cpp
| include /-
| CMakeList.txt --- 2
| AService /-
| CMakeList.txt --- 3
| Caio.h
| caio.lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment