I'm trying to use a library, specifically SOIL (Simple OpenGL Image Library) in Xcode 4.2.1. Under Build Phases -> Link Library with Libraries I add all the .h and .c files that came with the SOIL zip archive.
When I build the project, I get the following error message for every .h and .c file added:
warning: skipping file '/Users/saw/XcodeProjects/Assignment01 copy/Assignment01/image_DXT.c' (unexpected file type 'sourcecode.c.c' in Frameworks & Libraries build phase)
and a linker error:
"_SOIL_load_OGL_texture", referenced from: Init() in main.o Symbol(s) not found for architecture x86_64 Clang: error: linker command failed with exit code 1 (use -v to see invocation)
.h and .c files aren't libraries. Add the .c files to the compile phase and just #import
the .h files where needed.
To verify linking I have done the following:
src
folder: SOIL.c, image_DXT.h, stbi_DDS_aug.h, SOIL.h, image_helper.c,
stb_image_aug.c, stbi_DDS_aug_c.h, image_DXT.c, image_helper.h, and
stb_image_aug.h.applicationDidFinishLaunching:
method:
SOIL_load_OGL_texture( "img_test.png", SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID, 0 );
.Although there are a variety of compiler warnings about data conversion, these steps produce an executable with no linker errors.
Try adding -framework to your framework's name in the "Other Linker Flags" such as:
-framework SOIL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With