Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
111 user(s) are online (69 user(s) are browsing Forums)

Members: 2
Guests: 109

sailor, rwo, more...

Headlines

 
  Register To Post  

help with OS4.1 SDK gcc and 68k "legacy" code
Just popping in
Just popping in


See User information
Hello folks!

I hope that somebody can enlighten me on this:

It is not possible to compile bigger projects using so called "legacy" code, if it implies separate object link stages.

I tried with simplified command lines like this:

gcc -c source.(compiles fineobject file is written)

gcc -o objectfile -lauto gives

/SDK/newlib/lib/crtbegin.oIn function `_start':
(.text+0x14e): undefined reference to 
`main'
/SDK/newlib/lib/crtbegin.o: In function `_start'
:
(.
text+0x156): undefined reference to `main'

__USE_INLINE__ is #defined in the source code, btw.

Best bit on this: with

gcc -o executable sourcefile -lauto


all works nice and slick.

Can anybody explain me, why gcc behaves like this?

Another one: If I try to make the project with a makefile, it fails utterly in the linking stage with tons of "undefined reference to...", although linking is done with -lauto and __USE_INLINE__ #define d.

Compiling and linking only works with the basic command line above. Why is it this way? Am I doing something wrong? If so, what??

A more in-deep answer is highly appreciated, thank you very much.

Regards

Go to top
Re: help with OS4.1 SDK gcc and 68k "legacy" code
Home away from home
Home away from home


See User information
@whose

The -o parameter specifies the output executable name, so

gcc -o objectfile -lauto

Means that you're trying to create an executable called "objectfile" with no source/object files. It should be:

gcc -o executablename objectfile -lauto

That's a pretty easy mistake to make, and the error message is misleading.

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work
Go to top
Re: help with OS4.1 SDK gcc and 68k "legacy" code
Just popping in
Just popping in


See User information
@Hans

Argh, you are right! Thank you very much, I thought I went mad on this ;) Those damn overcomplicated makefiles lead me to this error, too, I tried to compare other example makefiles, as the one used on 68k doesnt work with the OS4 make (dont know why), but I dont get this one :/

Again, thank you very much Hans!

Regards

Go to top
Re: help with OS4.1 SDK gcc and 68k "legacy" code
Quite a regular
Quite a regular


See User information
Yes, even with my limited knowledge I sometimes wonder at times of the limited error syntax information, even though I pretty much guarantee in technical terms it is probably more than sufficent...

I decided I'm going to take some time this weekend and try a Spot (excuse the partial pun ) of compiling...

I noticed DosBox 0.73 has been released and the nice chap who compiled 0.72 and uploaded it left some fairly straight forward instructions about what goes and what doesn't...

Anyone wish to chuck any potential optimisations for the SAM while I'm at it?

i.e. something I could add on the command line... like I used to enjoy using -m68060 for classic etc...

we need a -cpu=SAM definition! which of course would make some things automatically default like -O3 would do etc...

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: help with OS4.1 SDK gcc and 68k "legacy" code
Just popping in
Just popping in


See User information
@Slayer

It is not only the sometimes strange syntax error information, it is the "implicit" wrong behaviour of other tools of the toolchain, too. I was used to compilers doing a straight compile when called without any special options or at least breaking with some error report on the file types given.

frontend gcc doesnt, it tried to do very unusual things instead, which lead to very annoying and misleading messages.

Even more annoying is the behaviour of make respectively its older flavours. You could omit -o option in the makefiles and then project was done without any hassle. Now you cant, or it will bite on you with e.g. "undefined reference to...".

Well, I know these pitfalls now and can help, when the next new developer stumble over this

Regards

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project