JWD
JWD

Reputation: 12218

.dylib linked in Debug, not found for Release for iPhone in XCode

So I have included the libxml2.2.dylib library into my iPhone XCode project to create some Xml and XPath parsing utilities. When I compile and run in Debug mode for both the Simulator and Device I have no problems, however, When I switch to Release mode I get...

"error: libxml/tree.h: No such File or directory" as well as other similar errors for the following .h files.

#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/HTMLparser.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>

What do I need to do to ensure the libary is included and linked to the Release build?

Upvotes: 10

Views: 8529

Answers (3)

cdespinosa
cdespinosa

Reputation: 20799

An error on the .h is a compile-time error with your Header Search Paths, not a .dylib or a linker error.

You have to ensure that ${SDK_DIR}/usr/include/libxml2 is in your Header Search Paths in your Release configuration.

Upvotes: 8

henghonglee
henghonglee

Reputation: 1812

do make sure that libxml is included in your project , that was the one that caused the problem for me.

add libxml2.2.7.3.dylib to linked libraries

Upvotes: 0

johndpope
johndpope

Reputation: 5249

i was going around in circles this morning with this same problem with xcode 4.

again as described exactly above, it builds with fine with Schema > Build Configuration --> Debug
but fails when switching it to Release

tried numerous cleans and adding ${SDK_DIR}/usr/include/libxml2 or $/usr/include/libxml2 and triple checking Header Search Paths / checking the recursive check box all to no avail. Was about to start a new project when ....

I managed to resolve it by adding
${SDK_DIR}/usr/include/libxml2 to the User Header Search Paths

Upvotes: 7

Related Questions