|Sep 2, 2008, 08:12 PM||#1|
Static & Dynamic Libraries
Is it possible to link static and/or dynamic libraries built with either gcc/g++ and use them in Xcode? If so, how do you accomplish it? I get the following errors when trying to build. I have added the directory with the header file to the search path. It picks it up in intellisense but it is not able to find it.
main.m:10:16: error: Add.h: No such file or directory
main.m: In function 'main':
main.m:13: error: 'Add' undeclared (first use in this function)
main.m:13: error: (Each undeclared identifier is reported only once
main.m:13: error: for each function it appears in.)
main.m:13: error: 'add' undeclared (first use in this function)
Also, I would like to separately develop a piece of the application outside of Objective C and use the C++ library in the iPhone application. Is this in violation of the SDK agreement and why?
Update: I have successfully compiled the library as a static library.
Here is how to enable static library compilation in Xcode with an iPhone application in Objective C.
1. Compile the objects and create a static library (.a extension)
3. Add include path to User Header Search Paths
5. Compile Sources As "Objective-C++"
6. Add Add.h (or other header files) to the user include directory
7. Include the directory in your .mm file
Last edited by bluetooth42; Sep 2, 2008 at 08:53 PM. Reason: Found solution for including static library in Xcode for iPhone application
|Sep 2, 2008, 11:40 PM||#2|
Just some advice. Xcode is not a makefile. Here's the easy way:
build your .a file
drag your .a file from the Finder into your project window
(OK you have to now build your project)
Leave the -l and the header search paths for others to fool with.
Also, to avoid the header search path jazz just add the header file to your project (and you're done).
Oh yeah, ar hah hah. You did use an Xcode project to build your .a file didn't you?
If you want Xcode to automatically build the .a file when the project that depends on it requires it you can do that also. Look at the docs.
|Sep 3, 2008, 04:01 AM||#3|
I don't know much about librairies (as in the difference between static/dynamic, different formats etc.), but I guess you'd have to compile the library to ARM code right ? How do you achieve that and get a .a file that would work on the iphone ?
Also, how do you handle the difference between simulator and iphone in this case ? can they both use the same library (I wouldn't think so, but as I said my knowledge is very limited).
If someone manages to compile code as a library and then link it in an iPhone project, I think a lot of us would be very grateful if you could give some detailed steps for this process.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|HDRist - High Dynamic Range & Exposure Blending||Doonsoft||Mac Applications and Mac App Store||1||Apr 23, 2014 09:48 PM|
|Dynamic or Static Wallpapers||sird28||iOS 7||20||Sep 26, 2013 02:35 AM|
|Do i have a dynamic or a static IP?||AppleTalker||OS X 10.8 Mountain Lion||14||Aug 28, 2013 08:36 PM|
|Dynamic Vs. Static Wallpapers||sird28||iOS 7||6||Aug 6, 2013 11:06 AM|
|locally hosted web server Static IP address cost v dynamic DNS cost?||infobleep||Mac OS X Server, Xserve, and Networking||6||Aug 4, 2012 10:31 AM|
All times are GMT -5. The time now is 02:32 PM.