Dylib problem

Posts: 20
Joined: 2010.09
Post: #1
Hi everyone,

While trying to get a simple dylib that fetches the resolution of Macintosh computers to work, I get this little error. There doesn't seem to be anything wrong with the code, but then again I'm quite new to C so I can't be sure what's wrong with what.

#include <stdio.h>
#include <stdlib.h>
#include <ApplicationServices/ApplicationServices.h>
extern "C" {

__attribute__((visibility("default"))) double GetPixelsWide( double _var );
GetPixelsWide( double _bar )
        //Get display width...
        double returnvar;
        //uint32_t ioflags;
        return returnvar;

The error(s, 2) I get is:

Quote: "_CGDisplayPixelsWide", referenced from:

"_CGMainDisplayID", referenced from:
_GetPixelsWide in gethome.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Any help? I can't reroute this to the main application's code... it must be in a dylib.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
You need to link to the ApplicationServices framework you included.
Quote this message in a reply
Posts: 20
Joined: 2010.09
Post: #3
Ahhh... my noobness shows up... and beautifully this time.

But your fixed worked beautifully. Thanks a lot. Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cocoa fundamentals - the message loop in a dylib bumperman 5 9,099 Nov 8, 2009 11:17 AM
Last Post: OneSadCookie
  how to debug a dylib? sakiel 1 5,565 Aug 16, 2007 07:26 PM
Last Post: OneSadCookie
  How to force the use of static libs when the dylib is present? Malarkey 4 9,036 Oct 12, 2006 04:33 PM
Last Post: Malarkey
  Linking to dylib in xCode Jones 6 8,605 Jun 26, 2006 02:08 PM
Last Post: OneSadCookie
  /sw/lib/libcurl.2.dylib to /usr/lib/??? (terminal...???) BinarySpike 10 10,135 May 2, 2005 10:05 AM
Last Post: BinarySpike