Я получил ошибку после связывания библиотеки GLFW, используя Makefile [Duplicate]C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Я получил ошибку после связывания библиотеки GLFW, используя Makefile [Duplicate]

Сообщение Anonymous »

Я пытался установить флаги по-разному, перекомпиляйте библиотеку и многое другое.TARGET = game.exe

C_COMPILER = gcc
CPP_COMPILER = g++

INCLUDE_FOLDER = -Iinclude
LIB_FOLDER = -Llib

SRC = $(wildcard *.cpp)
OBJ = $(patsubst %.cpp, %.o, $(SRC))

FLAGS = $(INCLUDE_FOLDER) $(LIB_FOLDER) -lgdi32 -lglfw3 -lopengl32

game : $(OBJ)
$(CPP_COMPILER) glad.o $(OBJ) $(FLAGS) -o $(TARGET)

#glad.o : glad.c
# $(C_COMPILER) -c glad.c -o glad.o $(FLAGS)

%.o : %.cpp
$(CPP_COMPILER) -c $< $(FLAGS) -o $@

clean :
rm $(OBJ) $(TARGET)
< /code>
Я получил эту ошибку: < /p>
g++ -c main.cpp -Iinclude -Llib -lgdi32 -lglfw3 -lopengl32 -o main.o
g++ glad.o main.o -Iinclude -Llib -lgdi32 -lglfw3 -lopengl32 -o game.exe
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x172): undefined reference to `__imp_CreateDCW'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1aa): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1c8): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x228): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x299): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x2c5): undefined reference to `__imp_DeleteDC'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xc64): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xc7c): undefined reference to `__imp_GetDeviceCaps'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x12d2): undefined reference to `__imp_CreateDCW'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x12f0): undefined reference to `__imp_GetDeviceGammaRamp'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1303): undefined reference to `__imp_DeleteDC'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x145e): undefined reference to `__imp_CreateDCW'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x147c): undefined reference to `__imp_SetDeviceGammaRamp'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x148f): undefined reference to `__imp_DeleteDC'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x237): undefined reference to `__imp_CreateDIBSection'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x2a5): undefined reference to `__imp_CreateBitmap'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x2d1): undefined reference to `__imp_DeleteObject'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x3d9): undefined reference to `__imp_DeleteObject'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x3e9): undefined reference to `__imp_DeleteObject'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc4e): undefined reference to `__imp_CreateRectRgn'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xcb3): undefined reference to `__imp_DeleteObject'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xd9): undefined reference to `__imp_DescribePixelFormat'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xd93): undefined reference to `__imp_DescribePixelFormat'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x118b): undefined reference to `__imp_SwapBuffers'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15be): undefined reference to `__imp_ChoosePixelFormat'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15d7): undefined reference to `__imp_SetPixelFormat'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1a30): undefined reference to `__imp_DescribePixelFormat'
C:\w64devkit\bin/ld.exe: lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1a73): undefined reference to `__imp_SetPixelFormat'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:15: game] Error 1


Подробнее здесь: https://stackoverflow.com/questions/796 ... g-makefile
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»