Howdy,
I've spent a few hours trying to do somethin' very simple: I have a .dylib I created in Xcode (BSD Dynamic Library) that I want to use in a command-line program I am compilin' with gcc.
How do I do this? The following page is the only help I've found on includin' a .dylib when using gcc:
Based on it, I am tryin':
$ g++ main.cpp Lib.dylib -o test
But I get the followin' errors:
/usr/bin/ld: Undefined symbols:
func()
...
etc.
The queer thing is, if I take .c and .h files from the Xcode project and compile 'em into a .dylib by hand, like so:
$ g++ -dynamiclib Lib.c -o Lib.dylib
Then I can compile my program just fine, as above! This solution ain't acceptable, however, because then the .dylib won't work with Maple11 worksheet for some reason.
When I look at the build details in Xcode, I see all sortsa flags like like -fpascal-strings and -no_farm_animals but I have no idea why the same exact code compiled by Xcode works in Maple11 but not with my gcc-compiled program, but the gcc-compiled .dylib works with my gcc-compiled program but not Maple11! (Tarnation!)
Any help will be 'ppreciated.
Milford Brimdash
(ps. usin' Xcode to write my command-line program is out, since when I right-click on "Link Binary with Libraries" and add the Lib.dylib, it then complains durin' build that "can't locate file for: -ILib")