So i managed to link FreeType2 with dynamically by just including the dependencies directories and not linking anything. Dynamically is cool and all but i would really like to link it statically. I tested precompiled binaries (which i got the dll from) and build my own (which i did by downloading, using cmake gui to build with the default options a .sln workspace and then clicked build all). But whatever i try to link or use statically, it will give me undefined references.
Heres the output:
MAKEFLAGS=s -j9
COMPILER_PATH=c:/progra~1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.2.0/;c:/progra~1/mingw64/bin/../libexec/gcc/;c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/;c:/progra~1/mingw64/bin/../lib/gcc/;c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../lib/;c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/;c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../
COLLECT_GCC_OPTIONS='-g' '-v' '-o' 'UI.exe' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
c:/progra~1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.2.0/collect2.exe -plugin c:/progra~1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.2.0/liblto_plugin-0.dll -plugin-opt=c:/progra~1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\Eric\AppData\Local\Temp\ccoaWDLZ.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic -o UI.exe c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/crtbegin.o -Lc:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0 -Lc:/progra~1/mingw64/bin/../lib/gcc -Lc:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib -Lc:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../lib -Lc:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib -Lc:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../.. @C:\Users\Eric\AppData\Local\Temp\ccmOOCrP -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/crtend.o
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../Dependencies/FreeType/freetype.lib(../../../objs/x64/Release Static/bdf.obj):(.xdata[$unwind$_bdf_parse_properties]+0x18): undefined reference to `__GSHandlerCheck'
c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
-This repeats for a while-
../Dependencies/FreeType/freetype.lib(../../../objs/x64/Release Static/bdf.obj):(.xdata[$unwind$_bdf_parse_start]+0x1c): undefined reference to `__GSHandlerCheck'
c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../Dependencies/FreeType/freetype.lib(../../../objs/x64/Release Static/bdf.obj):(.xdata[$unwind$bdf_interpret_style]+0x1c): undefined reference to `__GSHandlerCheck'
c:/progra~1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../Dependencies/FreeType/freetype.lib(../../../objs/x64/Release Static/bdf.obj):(.xdata[$unwind$BDF_Face_Init]+0x14): undefined reference to `__GSHandlerCheck'
collect2.exe: error: ld returned 1 exit status
mingw32-make[3]: *** [CMakeFiles\UI.dir\build.make:269: UI.exe] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:94: CMakeFiles/UI.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:101: CMakeFiles/UI.dir/rule] Error 2
mingw32-make: *** [makefile:136: UI] Error 2
Heres my cmake file:
make_minimum_required(VERSION 3.7)
project(UI)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(FREETYPE_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/Dependencies/FreeType/freetype.lib)
set(FREETYPE_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/Dependencies/FreeType/include)
set(CMAKE_CXX_STANDARD 20)
file(GLOB_RECURSE SOURCE_FILES "UI/*.cpp" "UI/*.h" "Sandbox/*.cpp" "Sandbox/*.h")
file(GLOB_RECURSE DEP_FILES "Dependencies/FreeType/src/*.c" "Dependencies/FreeType/src/*.h")
set(dir ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(Dependencies)
include_directories(${PROJECT_NAME} "Dependencies/OpenGL/include")
include_directories(${PROJECT_NAME} "Dependencies/Math/include")
include_directories(${PROJECT_NAME} "Dependencies/GLFW/include")
include_directories(${PROJECT_NAME} "Dependencies/FreeType/include")
include_directories(${PROJECT_NAME})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME}
${CMAKE_CURRENT_LIST_DIR}/Dependencies/FreeType/freetype.lib
${CMAKE_CURRENT_LIST_DIR}/Dependencies/OpenGL/OpenGL.a
${CMAKE_CURRENT_LIST_DIR}/Dependencies/Math/Math.a
${CMAKE_CURRENT_LIST_DIR}/Dependencies/GLFW/libglfw3.a
)
If anyone has any idea youre welcome to help me out :) Have a great day.