Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

myjay610

macrumors regular
Original poster
Jan 6, 2008
131
0
Hi all,

I've spent years programming in C/C++ but using Visual Studio or just gcc via command line. Now I have a need to use some of the APIs included with OS X. Do I need to pick a particular tool for this?

I first tried the C++ tool and I only need to use the Security/Security.h library for some keychain APIs. I try calling a simple function like SecKeychainGetVersion and I get collect2: ld returned 1 exit status, symbol(s) not found, "_SecKeychainGetVersion",referenced from:

I've included the header file as needed so I really don't know what's going on.

Thanks!
John
 
Hi all,

I've spent years programming in C/C++ but using Visual Studio or just gcc via command line. Now I have a need to use some of the APIs included with OS X. Do I need to pick a particular tool for this?

I first tried the C++ tool and I only need to use the Security/Security.h library for some keychain APIs. I try calling a simple function like SecKeychainGetVersion and I get collect2: ld returned 1 exit status, symbol(s) not found, "_SecKeychainGetVersion",referenced from:

I've included the header file as needed so I really don't know what's going on.

Thanks!
John

Did you include the framework too?
 
I've included CoreFoundation, Security, and CoreServices. I saw those included on a sample program I found somewhere.
John
 
You have to actually add the framework to the project to link against it, not just include the header files.

Just right-click on the Frameworks and Libraries group in the project window and select Add -> Existing Frameworks... and go to the System -> Library -> Frameworks folder and select the Security.framework and the other frameworks you included the headers for.

Then build and run it again.
 
You have to actually add the framework to the project to link against it, not just include the header files.

Just right-click on the Frameworks and Libraries group in the project window and select Add -> Existing Frameworks... and go to the System -> Library -> Frameworks folder and select the Security.framework and the other frameworks you included the headers for.

Then build and run it again.

Perfect, works now! Thanks!
John
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.