• 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: Adam <email@hidden>
  • Date: Sun, 16 Dec 2007 14:46:08 -0800
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

Thank you both for your responses, I combined them into one entry for convenience. 

On Dec 16, 2007, at 9:12 AM, Philip Aker wrote:

On 2007-12-16, at 08:50:01, Adam wrote:

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.

...but this is what I've been working with forever! Really, these are the same files that I've used since the last time I bugged you guys back in September. And the weird thing is, I made a few simple modifications to the code (and nothing to the main() function) and now it doesn't work. Was there some sort of auto-update to Xcode that could be messing me up? Because there's honestly no other way I can explain it.

It's impossible to give a full answer because the zipped project had files missing, duplicate files, system frameworks in the copy frameworks phase, a bad plist, etc. etc.

Really? I could have sworn it was the whole project... actually, you're right - I did delete files that had nothing to do with the project... and I couldn't say whether or not the plist was bad because I don't know anything about that sort of thing... try the link again, I removed the extra files...

http://adam-0.tripod.com/tetris.html

However, I think it best you limit the project to the Mac OS X 10.4 SDK and compiler target. The deprecated QuickDraw stuff is gone now and there is no 10.2 SDK installed with Leopard. All the examples I've seen are set up to use it for the PPC output.

I would do this, but I never really delved into the wealth of Xcode's features. Is it that vital that I fix this, could you tell me how, or can I just leave it alone?

BTW, the SDL OpenGL App project (1.2.12)  I started with wasn't the greatest example of an Xcode project I've ever seen and it could be compounding the errors from any changes you made + whatever is new in Xcode/Leopard.

I don't happen to have Leopard. Does that help?

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


Adam wrote:

....but this is what I've been working with forever! Really, these are the
same files that I've used since the last time I bugged you guys back in
September. And the weird thing is, I made a few simple modifications to the
code (and nothing to the main() function) and now it doesn't work. Was
there some sort of auto-update to Xcode that could be messing me up?
Because there's honestly no other way I can explain it.

Xcode doesn't auto-update, so that's not it.

I suggest backtracking the error from where it occurs: in the link step.
That means you need to look at all the symbols from the object-files being
linked, to find the definition of _main.

In your build folder, there's a ".build" sub-folder, and down in there a
couple levels should be any number of foo.o, bar.o, etc. for each foo.c,
bar.c source file.  Use the 'nm' command on them to list the symbols.  An
undefined or extern reference will be 'U', all defined symbols will have an
address and 'T' or 'D' (upper or lower case).

Is this the same for C++, because I did a search for it, and there was nothing...

If you don't find a definition for _main, then for some reason, the main()
in your source file isn't being compiled.  My first guess on that would be
an unterminated or mis-terminated #if or #ifdef.  That's a common cause for
huge tracts of missing code, in my experience.  A second possible cause is
a #define macro expansion that somehow eliminates the code or its symbol.
A symbol can be "eliminated" as linkable (i.e. extern storage class) but
still exist if it has the 'static' keyword in front of it, so that's
another thing to look for.

I don't have any #ifs or #ifdefs or #defines in my code. I checked the number of brackets, and that checks out nicely. This is what my main() is:

int main(int argc, char *argv[])
{
initialize();
fileout << "Initialization complete." << endl << flush;

event_loop();
fileout << "Event loop finished." << endl << flush;


cout << endl << "Game over." << endl
<< "Your score is: " << score << endl
<< "Level " << level;
    SDL_bool success;
    success = SDL_RemoveTimer(timer);
    SDL_Quit();
fileout << "Cleanup complete." << endl << flush;

    

    return 0;
}

And I'm wondering if I need the int argc and char *argv[] things at the beginning- I had those when I was using GLUT, but now I'm using SDL, so does it appear that those parts are obsolete?

If you do find a definition for _main in one of your .o files, then you at
least know it's being compiled.  See 'man nm' for what the symbol types
[TtDd] mean, because it might be the wrong type for some reason.

Knowing which .o file _main is in, you next need to look at the list of
files being linked, to make sure main's .o file is listed.  Look at the
full link command in the detailed build transcript, find its -filelist arg,
then go look in the file-list file it refers to.  That file contains text,
one pathname per line, for each file to be linked.

Here's a recent summary of instructions for how to view the build transcript:
  <http://lists.apple.com/archives/xcode-users/2007/Dec/msg00489.html>
or search the list archives for keywords: build transcript.

  -- GG

I looked through the build transcript, and it said:

[...]-o "/Users/atg/Desktop/Projects/Xcode Projects/Release/Tetris_020.app/Contents/MacOS/Tetris_020"[...]

So I looked at the place it specified, and there was nothing in the "MacOS" folder.
In short, I didn't understand everything you said, and this is confusing the heck out of me, but thanks for the help.


All help is appreciated and thanks in advance.

~ < [ / Adam-o \ ] > ~

Mac OS 10.4.11
Powerbook G4
 _______________________________________________
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: Steve Checkoway <email@hidden>
References: 
 >Re: Interpreting "undefined symbols" (From: Adam <email@hidden>)
 >Re: Interpreting "undefined symbols" (From: Philip Aker <email@hidden>)
 >Re: Interpreting "undefined symbols" (From: Adam <email@hidden>)
 >Re: Interpreting "undefined symbols" (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: inlining
  • Next by Date: Re: Xcode-users Digest, Vol 4, Issue 712
  • Previous by thread: Re: Interpreting "undefined symbols"
  • Next by thread: Re: Interpreting "undefined symbols"
  • Index(es):
    • Date
    • Thread