小编bei*_*eis的帖子

在优胜美地中通过g ++链接SOIL的问题

我一直在尝试为正在使用OpenGL的项目链接SOIL。我正在运行优胜美地10.10.4。

当我尝试在代码中使用SOIL库时,出现以下错误(已更新):

ld: warning: ignoring file /usr/local/lib/libSOIL.a, 
file was built for archive which is not the architecture being linked (x86_64): /usr/local/lib/libSOIL.a
Undefined symbols for architecture x86_64:
"_SOIL_load_image", referenced from:
  init() in main-93f615.o
ld: symbol(s) not found for architecture x86_64
Run Code Online (Sandbox Code Playgroud)

我的脚步

我遵循SOIL中make文件指示的过程:make,make install。它将libSOIL.a文件放在/ usr / local / lib中,将SOIL.h放在/ usr / local / include中。我包含在我的代码中:

#include "SOIL.h"

int width, height;
unsigned char* image = SOIL_load_image("CrayonBox2.png", &width, &height, 0, SOIL_LOAD_RGB);
Run Code Online (Sandbox Code Playgroud)

我的Makefile包含以下g ++目标:

g++ -I/usr/X11R6/include -I/usr/local/include -I/opt/local/include -L/usr/local/lib/ -L/opt/local/lib -lSOIL -framework …
Run Code Online (Sandbox Code Playgroud)

c++ opengl macos soil

5
推荐指数
1
解决办法
1471
查看次数

标签 统计

c++ ×1

macos ×1

opengl ×1

soil ×1