I am trying to link glew and glfw on clion with cmake. I did it with visual studio easilly, but I am having problems with clion. This is how I have included my dependencies like glew (.dll shouldnt be there I guess):
And this is my cmake file.
cmake_minimum_required(VERSION 3.6)
project(Course)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
find_package(OpenGL REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLFW/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLFW/libs)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLEW/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLEW/libs)
set(SOURCE_FILES main.cpp Window.cpp Window.h)
add_executable(Course ${SOURCE_FILES})
target_link_libraries(Course ${OPENGL_LIBRARY} libglew32.a libglfw3.a )
Error:
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x42c): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x448): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x464): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x478): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x48c): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x4a0): more undefined references to `wglGetProcAddress#4' follow
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1de1f): undefined reference to `wglGetCurrentDC#0'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1de8f): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1dea3): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1debe): undefined reference to `wglGetCurrentDC#0'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1df3a): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1e0c0): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1e0dc): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1e0fa): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1e4dc): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x1e4f8): more undefined references to `wglGetProcAddress#4' follow
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x20352): undefined reference to `glGetString#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x204d4): undefined reference to `glGetIntegerv#8'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x204e3): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x2055e): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x2057a): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x20596): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x205ac): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x20665): more undefined references to `wglGetProcAddress#4' follow
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26e21): undefined reference to `glGetString#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26f31): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26f47): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26f60): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26f7b): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26f8f): undefined reference to `wglGetProcAddress#4'
C:/Users/Onur/Documents/MEGA/workspace/cpp/Course/Dependencies/GLEW/libs\libglew32.a(glew.o):glew.c:(.text+0x26fa3): more undefined references to `wglGetProcAddress#4' follow
Seems like cmake can't find glew (but I told it where glew is?):
Edit:
Adding ${OPENGL_LIBRARIES} at the end of target_link_libraries worked
cmake_minimum_required(VERSION 3.6)
project(Course)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
find_package(OpenGL REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLFW/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLFW/libs)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLEW/include/GL)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GLEW/libs)
set(SOURCE_FILES main.cpp Window.cpp Window.h)
add_executable(Course ${SOURCE_FILES})
target_link_libraries(Course glfw3.a libglew32.a ${OPENGL_LIBRARIES})
Related
so i was trying to set up vulkan on vscode in windows.
and i strugle to fix the link errors.
at first i had problems with GLFM
but it looks like i sorted it out, by compiling it with mingw myself.
but now i guess the following link error
undefined reference to `vkEnumerateInstanceExtensionProperties#12'
how should i resolve that issue?
my makefile looks like that at the moment:
DIR1 := external/GLFM/include
DIR2 := external/glm/
DIR3 := external/vulkan/Include
INC=$(DIR1) $(DIR2) $(DIR3)
INC_PARAMS=$(foreach d, $(INC), -I$d)
LDPATHS2 := -Lexternal/GLFM/Lib/ -Lexternal/vulkan/Lib/
LDLIBS = -lglfw3 -lvulkan-1 -lgdi32
VulkanTest: main.cpp
g++ $(CFLAGS) $(INC_PARAMS) $(LDPATHS2) -o VulkanTest main.cpp $(LDLIBS)
EDIT:
i have added the -lgdi32 as that seemed to get rid of all of those
link errors:
C:\Users\Michael\AppData\Local\Temp\ccRgsVDp.o:main.cpp:(.text.startup+0x7c): undefined reference to `vkEnumerateInstanceExtensionProperties#12'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x12b): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x166): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x181): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1d4): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x257): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x29f): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa49): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa64): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf06): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf23): undefined reference to `_imp__GetDeviceGammaRamp#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf33): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x107b): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1098): undefined reference to `_imp__SetDeviceGammaRamp#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x10a8): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1f5): undefined reference to `_imp__CreateDIBSection#24'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x268): undefined reference to `_imp__CreateBitmap#20'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x295): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x387): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x397): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xbe1): undefined reference to `_imp__CreateRectRgn#16'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc41): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x6c4): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xbbf): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xf4a): undefined reference to `_imp__SwapBuffers#4'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x126e): undefined reference to `_imp__ChoosePixelFormat#8'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x128b): undefined reference to `_imp__SetPixelFormat#12'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15b4): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15fd): undefined reference to `_imp__SetPixelFormat#12'
I have my project, nested in another directory with the required libraries for my project. I'm using cmake that's bundled with Clion, 3.14. I am using subdirectories with cmake. I have it building just fine, but it's not linking SFML
Root-|
-lib1
-smfl
-lib3
-my_project
I've tried using things like using 'target_link_directories()' but either I did it wrong, or it's absolutely not the right option.
Root CMakeList.txt
cmake_minimum_required(VERSION 3.10)
include_directories("ChaiScript/include" Catch2/include freetype2/include SFML/include )
add_subdirectory(Catch2)
add_subdirectory(ChaiScript)
add_subdirectory(freetype2)
add_subdirectory(SFML)
add_subdirectory(Purrmaid)
./Purrmaid/CMakeList.txt
cmake_minimum_required (VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
project (purrmaid)
add_executable( purrmaid
main.cpp
Base_Object.cpp
...
ThreadManager.cpp)
target_link_libraries(purrmaid sfml-system sfml-window sfml-graphics sfml-network sfml-audio pthread dl)
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_MulFix'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Init_FreeType'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Get_Char_Index'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Get_Kerning'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Get_Glyph'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_New_Face'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Stroker_Set'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Glyph_To_Bitmap'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Outline_Embolden'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Load_Char'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Done_Glyph'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Stroker_New'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Open_Face'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Glyph_Stroke'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Bitmap_Embolden'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Done_Face'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_New_Memory_Face'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Stroker_Done'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Done_FreeType'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Set_Pixel_Sizes'
../SFML/lib/libsfml-graphics-d.so.2.5.1: undefined reference to `FT_Select_Charmap'
The error shown is that SFML cannot link because it cannot find reference to different FT_ symbols (FT_MulFix, FT_Init_FreeType, etc.)
These are defined by the FreeType library. I assume you are building the different SFML targets when you add_subdirectory(SFML)
In the CMakeLists.txt file in the SFML subdirectory, do you link the sfml-graphics target against Free type?
add_library(sfml-graphics
...)
# This is assuming you have a "freetype2" target available
# please replace by the actual name of the freetype target
target_link_libraries(sfml-graphics freetype2 ...)
EDIT: Thanks to Tsyvarev for pointing me in the direction of the actual target that was not able to link.
This question already has answers here:
How to add "-l" (ell) compiler flag in CMake
(2 answers)
Closed 3 years ago.
I am trying to use curl inside c++ code. How should i do it properly ?
I have pasted libcurl.a & libcurl.dll.a in this directory:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\lib
This is my CMakeLists.txt from CLion/Mingw
cmake_minimum_required(VERSION 3.3)
project(tan)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -lcurl.dll")
add_executable(tan Tan/mail.cpp)
project(untitled6)
When I add "#define CURL_STATICLIB" i get these errors:
reference to `curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined
reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tam/mail.cpp:121: undefined reference to ````curl_easy_cleanup
Without "#define CURL_STATICLIB" i get these errors:
CMakeFiles\tan.dir/objects.a(mail.cpp.obj): In function `main':
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:81: undefined reference to `__imp_curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `__imp_curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `__imp_curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `__imp_curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:121: undefined reference to `__imp_curl_easy_cleanup'
If anybody comes looking use this in CMakeLists.txt. The last line solved the issue.
Step1:
Copy libcurl.dll.a in C:/curl.
No need to copy "libcurl.a" OR "libcurl.dll.a" at any other place.
No need for #define CURL_STATICLIB in main.cpp file
Step2: Edit the CMakeLists.txt as below.
set(CMAKE_CXX_STANDARD 14)
add_executable(tan Tan/mail.cpp)
project(untitled6)
target_link_libraries(tan "C:/curl/libcurl.dll.a")
Step3: If your program flashes quickly and closes. You might be missing some dll files. To check which ones you are missing , run the program (in my case tan.exe) with cmd. Take that dll from curl package (in my case curl-7.65.0-win64-mingw) and put it along side of your executable file. Make sure curl and your executable is compiled with same compiler. In my case it's Mingw.
I am trying to compile a qt project with qtcurl using a statically built curl.
I am using the following to build a minimalist curl static library:
./configure --disable-shared --enable-static --prefix=/tmp/curl --disable-ldap --disable-sspi --without-librtmp --disable-ftp --disable-file --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-smb --without-libidn --enable-ares
I am including
-L/tmp/curl/lib/libcurl.a
in the LIBS of the project, and
/tmp/curl/include
in the INCLUDEPATH
This is the output that I am getting:
QtCUrl.o: In function `QtCUrl::QtCUrl()':
QtCUrl.cpp:(.text+0x10d): undefined reference to `curl_easy_init'
QtCUrl.o: In function `QtCUrl::~QtCUrl()':
QtCUrl.cpp:(.text+0x32e): undefined reference to `curl_slist_free_all'
QtCUrl.cpp:(.text+0x355): undefined reference to `curl_easy_cleanup'
QtCUrl.o: In function `QtCUrl::setOptions(QHash<CURLoption, QVariant>&)':
QtCUrl.cpp:(.text+0xcee): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0xdac): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0xee9): undefined reference to `curl_slist_append'
QtCUrl.cpp:(.text+0xfe5): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0x1078): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0x109f): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0x1155): undefined reference to `curl_easy_setopt'
QtCUrl.cpp:(.text+0x1290): undefined reference to `curl_easy_setopt'
QtCUrl.o: In function `QtCUrl::exec(QHash<CURLoption, QVariant>&)':
QtCUrl.cpp:(.text+0x1f27): undefined reference to `curl_easy_perform'
QtCUrl.o: In function `curlGlobalInit()':
QtCUrl.cpp:(.text+0xa6): undefined reference to `curl_global_init'
collect2: error: ld returned 1 exit status
What am I missing here?
complete CMake Noob here. I am trying to use glfw library in Clion IDE and even after 2 days of googling, i cannot understand what am i missing/doing wrong.
Here are the details:
OS: Windows 8 Pro 64bit
IDE: Clion
Make tool: CMake
Complier: MinGW v3.21
Error log:
"C:\Program Files (x86)\JetBrains\CLion 1.2.3\bin\cmake\bin\cmake.exe"--build C:\Users\PranayKarani\.CLion12\system\cmake\generated\185d1d8\185d1d8\Debug --target openGL -- -j 4
[ 50%] Linking CXX executable openGL.exe
CMakeFiles\openGL.dir/objects.a(main.cpp.obj): In function `key_callback':
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:15: undefined reference to `glfwSetWindowShouldClose'
CMakeFiles\openGL.dir/objects.a(main.cpp.obj): In function `main':
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:22: undefined reference to `glfwSetErrorCallback'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:24: undefined reference to `glfwInit'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:27: undefined reference to `glfwCreateWindow'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:30: undefined reference to `glfwTerminate'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:34: undefined reference to `glfwMakeContextCurrent'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:35: undefined reference to `glfwSwapInterval'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:37: undefined reference to `glfwSetKeyCallback'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:44: undefined reference to `glfwGetFramebufferSize'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:47: undefined reference to `_imp__glViewport#16'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:48: undefined reference to `_imp__glClear#4'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:50: undefined reference to `_imp__glMatrixMode#4'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:51: undefined reference to `_imp__glLoadIdentity#0'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:52: undefined reference to `_imp__glOrtho#48'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:53: undefined reference to `_imp__glMatrixMode#4'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:55: undefined reference to `_imp__glLoadIdentity#0'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:56: undefined reference to `glfwGetTime'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:56: undefined reference to `_imp__glRotatef#16'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:58: undefined reference to `_imp__glBegin#4'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:59: undefined reference to `_imp__glColor3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:60: undefined reference to `_imp__glVertex3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:61: undefined reference to `_imp__glColor3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:62: undefined reference to `_imp__glVertex3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:63: undefined reference to `_imp__glColor3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:64: undefined reference to `_imp__glVertex3f#12'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:65: undefined reference to `_imp__glEnd#0'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:67: undefined reference to `glfwSwapBuffers'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:68: undefined reference to `glfwPollEvents'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:39: undefined reference to `glfwWindowShouldClose'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:71: undefined reference to `glfwDestroyWindow'
E:/Pranay/BotX games/C++ projects/openGL/main.cpp:73: undefined reference to `glfwTerminate'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\openGL.dir\build.make:97: recipe for target 'openGL.exe' failed
mingw32-make.exe[3]: *** [openGL.exe] Error 1
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/openGL.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/openGL.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/openGL.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/openGL.dir/rule] Error 2
Makefile:117: recipe for target 'openGL' failed
mingw32-make.exe: *** [openGL] Error 2
Project structure:
CMakeList.txt
cmake_minimum_required(VERSION 3.3)
project(openGL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
add_executable(openGL ${SOURCE_FILES})
#add_library(A SHARED IMPORTED)
#set_property(TARGET A PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/GLFW/lib-mingw-w64/glfw3.dll)
add_library(B STATIC IMPORTED)
set_property(TARGET B PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/GLFW/lib-mingw-w64/glfw3dll.a)
add_library(C STATIC IMPORTED)
set_property(TARGET C PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/GLFW/lib-mingw-w64/libglfw3.a)
target_link_libraries(openGL B C)
This is how i fixed this headache:
Downloaded 32 bit of glfw binaries (even though i am on 64 bit machine)
Renamed and Copy pasted selected files from the binaries in my project like this:
modified my CMakeLists.txt like this:
build and hit Run!
Add the following at the end of the CMakeLists.txt
find_package(glfw3 REQUIRED )
target_link_libraries(projectname GL glfw)