• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interpreting "undefined symbols"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpreting "undefined symbols"


  • Subject: Re: Interpreting "undefined symbols"
  • From: Philip Aker <email@hidden>
  • Date: Sun, 16 Dec 2007 04:18:53 -0800

On 2007-12-15, at 23:21:23, Adam wrote:

When modifying an OpenGL program that I found on nehe.gamedev.net, for some reason I get the following error code:

/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status

...and yet I have the main function defined! Sorry if this is a stupid question or something, but my head hurts pretty bad right now from trying to figure this out... I bet it's something simple, but I can't figure it out.

I bet it's because your main function is in a C++ source and isn't declared extern "C".

Even when I declared main() as extern "C", it had the errors.

I didn't have this problem until a short while ago, when I made some minor changes to the program, and now I can't get any of my Xcode projects to work - they all have this error message now. I didn't change anything in the Xcode preferences, either. Any ideas?

All help is appreciated and thanks in advance.

Chances are this is a variant of the SDL OpenGL App project and you tried to adapt it to your needs by changing a few names here and there and thinking you could bypass the layer of 'main' shenanigans SDL uses to work in a Cocoa app.


That's not going to work because at minimum you have to coordinate the product and executable name change with the items in the Info.plist of the target so that the resulting application has Info.plist and InfoPlist.strings files with a valid ExecutableName/ BundleName values.

Then there's the 'main' stuff. I wouldn't recommend anything other than finding the 'main' in the atlantis files and snapping your code in there for this type of project.

OTOH, there is another example Xcode application in one or another of the SDL distributions which has many targets. One of those might be better for your purposes if you don't need the Cocoa.

HTH,

Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Interpreting "undefined symbols"
      • From: Adam <email@hidden>
References: 
 >Re: Interpreting "undefined symbols" (From: Adam <email@hidden>)

  • Prev by Date: Re: Subversion and svn_load_dirs.pl
  • Next by Date: Re: Interpreting "undefined symbols"
  • Previous by thread: Re: Interpreting "undefined symbols"
  • Next by thread: Re: Interpreting "undefined symbols"
  • Index(es):
    • Date
    • Thread