Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Multiple definitions of _main
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple definitions of _main



Craig

I got it now.... My mistake for not putting -nofor-main in the link step but
only in the compile steps.

All is working now.

Thank you very much for your help.

Jan Theron


On 7/14/07 12:04 PM, "email@hidden"
<email@hidden> wrote:

> Send Fortran-dev mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/fortran-dev
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Fortran-dev digest..."
>
>
> Today's Topics:
>
>    1. Re: Multiple definitions of _main (Craig Hunter)
>    2. Re: Multiple definitions of _main (Johannes Theron)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 13 Jul 2007 15:20:28 -0400
> From: Craig Hunter <email@hidden>
> Subject: Re: Multiple definitions of _main
> To: <email@hidden>, <email@hidden>
> Message-ID: <C2BD48BC.B2DC%email@hidden>
> Content-Type: text/plain; charset="US-ASCII"
>
>> Message: 1
>> Date: Thu, 12 Jul 2007 22:06:03 -0700
>> From: Johannes Theron <email@hidden>
>> Subject: Multiple definitions of _main
>> To: <email@hidden>
>> Message-ID: <email@hidden>
>> Content-Type: text/plain; charset="US-ASCII"
>>
>> I am trying to compile a mixed C (using gcc 4.0) and Fortran (using Intel
>> Fortran) application and linking it to TCLTK and X11 libraries. My machine
>> runs OSX 10.4.10. This same application works like a charm using XLF fortran
>> and gcc on both G4 and G5 running OSX 10.3
>>
>> I run ar and ranlib on all my object files before linking but get the
>> following error right at the end:
>>
>> ifort -Wl,-multiply_defined suppress og.o lib/libtools.a -L/usr/X11R6/lib
>> -L/sw/lib -ltk8.4 -ltcl8.4 -lGLU -lGL -lX11 -lXmu -lXext  -o og
>> ld: multiple definitions of symbol _main
>> /opt/intel/fc/10.0.016/lib/for_main.o definition of _main in section
>> (__TEXT,__text)
>> og.o definition of _main in section (__TEXT,__text)
>>
>> I also get the same error when using the Portland Group Fortran compiler on
>> the same machine. I get a huge number of error messages when trying to use
>> the gcc 3.3 compiler.
>>
>> Does anyone have any ideas?
>>
>> Jan Theron
>
>
> If your c code contains the main entry point into the program, then you need
> to tell ifort not to create one (which it does by default).  Try the
> "-nofor-main" flag.
>
> Craig


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

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.