I tried to bundle SOIL for a project I'm working on with OpenGL. I am launching Yosemite 10.10.4.
When I try to use the SOIL library in my code, I get the following error (updated):
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
My steps
I followed the process indicated by the make file in SOIL: make, make install. He placed the file libSOIL.a in / usr / local / lib and SOIL.h in / usr / local / include. I included in my code:
#include "SOIL.h"
int width, height;
unsigned char* image = SOIL_load_image("CrayonBox2.png", &width, &height, 0, SOIL_LOAD_RGB);
And my Makefile contained this g ++ target:
g++ -I/usr/X11R6/include -I/usr/local/include -I/opt/local/include -L/usr/local/lib/ -L/opt/local/lib -lSOIL -framework GLUT -framework OpenGL -framework CoreFoundation -o main main.cpp
Then the above error appeared.
: SOIL Mac OS ( libSOIL.a libSOIL.dylib in/opt/local/lib SOIL.h /opt/local/include ); '-arch 1386 -arch x86_64' . , .
- , ?