Dolarun
@Dolarun

Почему линковщик пропускает библиотеку?

Вот ошибка:
Linking CXX shared library lib2DPrimitive.dll
c:/users/79306/desktop/development-libraries/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Users/79306/Documents/GitHub/2DPrimitiveLib/source/deps/lib/libglfw3.a when searching for -lglfw3
c:/users/79306/desktop/development-libraries/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Users/79306/Documents/GitHub/2DPrimitiveLib/source/deps/lib\libglfw3.a when searching for -lglfw3
c:/users/79306/desktop/development-libraries/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Users/79306/Documents/GitHub/2DPrimitiveLib/source/deps/lib/libglfw3.a when searching for -lglfw3
c:/users/79306/desktop/development-libraries/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3: No such file or directory
c:/users/79306/desktop/development-libraries/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Users/79306/Documents/GitHub/2DPrimitiveLib/source/deps/lib/libglfw3.a when searching for -lglfw3
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [source\CMakeFiles\2DPrimitiveD.dir\build.make:116: source/lib2DPrimitive.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:125: source/CMakeFiles/2DPrimitiveD.dir/all] Error 2
mingw32-make: *** [makefile:100: all] Error 2

Вот source/CmakeLists.txt:
cmake_minimum_required(VERSION 3.2)

set(SOURCES 
Point.cpp 
Window.cpp)

set(HEADERS 
Point.hpp 
Window.hpp)

set(EXTERN_LIBS
glad
glfw3)


#Static
add_library(2DPrimitiveS STATIC ${SOURCES} ${HEADERS})

target_link_directories(2DPrimitiveS PRIVATE
deps/lib)

target_include_directories(2DPrimitiveS PRIVATE
deps/include)

target_link_libraries(2DPrimitiveS PRIVATE ${EXTERN_LIBS})

set_target_properties(2DPrimitiveS
PROPERTIES 
ARCHIVE_OUTPUT_DIRECTORY "../lib/"
OUTPUT_NAME 2DPrimitive)


#Dynamic
add_library(2DPrimitiveD SHARED ${SOURCES} ${HEADERS})

target_link_directories(2DPrimitiveD PRIVATE
deps/lib)

target_include_directories(2DPrimitiveD PRIVATE
deps/include)

target_link_libraries(2DPrimitiveD PRIVATE ${EXTERN_LIBS})

set_target_properties(2DPrimitiveD
PROPERTIES 
ARCHIVE_OUTPUT_DIRECTORY "../lib/"
POSITION_INDEPENDENT_CODE ON
OUTPUT_NAME 2DPrimitive
)

Вот корневной CmakeLusts.txt:
cmake_minimum_required(VERSION 3.2)

project(2DPrimitive CXX)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(source)

Структура проекта:
620c98075cb0a272505725.png
Не собирает динамическую библиотеку.
  • Вопрос задан
  • 170 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы