English 中文(简体)
哪些连接旗帜是 glad?
原标题:What is the linker flag for glad on Mac?

www.un.org/spanish/ecosoc 这是我的发言。

SRC_DIR = src
BUILD_DIR = build/debug
CC = clang++
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_NAME = game
INCLUDE_PATHS = -Iinclude
LIBRARY_PATHS = -Llib -Llib//Users/baguma/Downloads/glad-3 -Llib/GL 
COMPILER_FLAGS = -std=c++11 -Wall -O0 -g -arch x86_64 
LINKER_FLAGS = -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lGLEW

all:
    $(CC) $(COMPILER_FLAGS) $(LINKER_FLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(SRC_FILES) -o $(BUILD_DIR)/$(OBJ_NAME)
clean:
    rm -r -f $(BUILD_DIR)/*

This is the error I m getting:

Undefined symbols for architecture x86_64:
  "_gladLoadGLLoader", referenced from:
      _main in main-d336bf.o
  "_glad_glViewport", referenced from:
      framebuffer_size_callback(GLFWwindow*, int, int) in main-d336bf.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1

利用开放Gl、冰川和喜悦编制方案

我看不出有任何帮助。

最佳回答

它像你再次遇到的问题一样,是因为联系人无法找到发展权利小组的职能。 通常的情况是,没有正确汇编或与你的项目挂钩。 在这方面,你可以确定:

  1. Include GLAD in Your Project: Ensure that the glad.c file is included in your source files for compilation. If you re using a Makefile, you should add glad.c to your SRC_FILES like so:

SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp) path/to/glad.c
  1. Update Include and Library Paths: Verify that your include and library paths in the Makefile are correctly pointing to where GLAD and other dependencies are located. For example:

INCLUDE_PATHS = -Iinclude -Ipath/to/glad
  1. Adjust Linker Flags: Ensure that the linker flags are placed correctly in your compilation command in the Makefile. Flags like -lglfw3 and -lGLEW should come after the source files:

$(CC) $(COMPILER_FLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(SRC_FILES) $(LINKER_FLAGS) -o $(BUILD_DIR)/$(OBJ_NAME)

下面是你更新的《马克图书》可以研究的一个实例:

SRC_DIR = src
BUILD_DIR = build/debug
CC = clang++
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp) path/to/glad.c
OBJ_NAME = game
INCLUDE_PATHS = -Iinclude -Ipath/to/glad
LIBRARY_PATHS = -Llib
COMPILER_FLAGS = -std=c++11 -Wall -O0 -g -arch x86_64 
LINKER_FLAGS = -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lGLEW

all:
    $(CC) $(COMPILER_FLAGS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(SRC_FILES) $(LINKER_FLAGS) -o $(BUILD_DIR)/$(OBJ_NAME)
clean:
    rm -r -f $(BUILD_DIR)/*
问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签