• 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: "B.J. Buchalter" <email@hidden>
  • Date: Mon, 17 Dec 2007 23:01:08 -0500

Adam,

I downloaded your project. I am on Leopard and Xcode 3; I needed to upgrade your project to a native target and set the .cpp files to compile as obj-c++, but once I did that the project built, linked and ran just fine.

So, I am not sure what to suggest; it just seems to work for me.

Perhaps you should try upgrading the project to use a native target instead of the JAM based target that you are currently using.

Best regards,

B.J Buchalter


On Dec 17, 2007, at 10:25 PM, Adam wrote:

Adam wrote:

Yes, and it still gives the same errors, and it would define 2
"main()"s, seeing that mine has one also. I seem to remember needing
those files for something, but what?

You have to include SDL_main.h in the file containing your main (that's the one with the macro to rename your main to SDL_main). It's needed because the SDLMain.m has to setup the window and event loop before your code can start.

I included it, and still, no dice. Link to code with SDL files included:


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

Hit the second link; you already have the first one if you dl'ed it.

Adam wrote:

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

Yes it's the same for C++. I just tried it on a C++ project, and _main was
listed. It was a no-brainer, though, since my main() is in main.cp, which
compiles to main.o.


You might want to describe how you searched for main, or even post the
command-line. Here's the one I used as the first try at finding main:
nm *.o | grep main


Since it found a _main symbol of type 'T', I am sure that a _main function
is defined in one of my .o files. If you don't see any output from grep,
then you probably DON'T have _main defined, which would be consistent with
the linker error you get. If you DO have a symbol called main defined,
i.e. grep produces some output, please copy and paste its entire output
into an email and post it to the list.


I ran the above command-line in this sub-dir of my project folder:
  build/MYPROJECT.build/Debug/MYTARGET.build/Objects-normal/i386

I found no ".build" file searching my entire hard drive, let alone the builds folder.


The "MYPROJECT" and "MYTARGET" are specific to my project and target, but
everything else is literal. This is for the Debug build configuration.
For the Release config, replace "Debug" in the above pathname with
"Release".



int main(int argc, char *argv[])
{
...

If you're going to post code, post the entire file with the #includes that
come before main(). It provides essential context for understanding your
code.

The code is available for download, and if you would like to look at it, you may download it at my website. Other than that, I cannot copy the whole file, as it would go over the size limit set by the lists. Trust me, I tried it once.
I posted what code I thought might be relevant.


[...]-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.

You're looking in the wrong place. That;s the output of the linker. I
suggested that you look at the linker inputs, i.e. the .o files. Since the
linker is failing, there isn't any output, so of course there's nothing
there.


Please reread what I originally wrote. I didn't suggest looking in the -o
output location, but in the build folder of your project (see example
pathname above). I also suggested finding the -filelist option, not the -o
option.


-- GG

You lost me the first time, and you have lost me again.
The reason I'm coming here for help is because I have absolutely no way of knowing how to do what you are talking about, or else I would have done it and left you guys alone.


Adam wrote:

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


The latest project file has the same problem I identified with the
last one. Namely, SDLMain.m isn't being built. Go back and read what I
wrote. I strongly suspect that will fix your problem since SDL.h
includes SDL_main.h which has
#define main SDL_main


Your main is being renamed to SDL_main. (If you do as others have
suggested and run nm on the object files, you'll see _SDL_main there.)
You need the main in SDLMain.m.

As I mentioned, I added the SDLmain files to no avail.

Basically, the problem that I'm having is that I don't know what is wrong, and you guys seem to think that it has to do with the SDLmain files. I suggest that you guys create a functional project (since you all seem aware of how to do it, it should take minimal modifications and time) and I can get on with my programming. I save you time, you save me time. This may seem bad to you because you're doing the work and I'm learning "nothing", but in reality we're just saving each other time and we can both get on with our programming, not spend hours trying to figure something out that could take almost no time. Just a thought...


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

B.J. Buchalter Metric Halo http://www.mhlabs.com


_______________________________________________ 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
References: 
 >Re: Interpreting "undefined symbols" (From: Adam <email@hidden>)

  • Prev by Date: Re: Interpreting "undefined symbols"
  • Next by Date: Re: Interpreting "undefined symbols" {almost fixed}
  • Previous by thread: Re: Interpreting "undefined symbols"
  • Next by thread: WHy is Xcode such a PITA?
  • Index(es):
    • Date
    • Thread