Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Managed C project with several main() functions
Managed C project with several main() functions [message #157087] Mon, 31 October 2005 16:33 Go to next message
Eclipse UserFriend
Originally posted by: fbarsoba.verizon.net

Hi all,

I'd like to have several files with their correspondent main() functions
under the same project. When I try to do it, I get the error 'multiple
definition of main'. Could anyone tell me what paramtere do I have to
change or how do I have to create the managed project?

thanks,

FBM
Re: Managed C project with several main() functions [message #157129 is a reply to message #157087] Mon, 31 October 2005 19:18 Go to previous messageGo to next message
Henning Riedel is currently offline Henning RiedelFriend
Messages: 310
Registered: July 2009
Senior Member
What does give the error? The CDT or the compiler/linker.
I gues its the linker, which is normal if you compile multiple main's
into one executable!

Try if you can exclude one or the other file from the build process.

Right now, the interface for the following is a little awkward.
Create in the Project Settings multiple Build Configurations for each of
the files with main(), e.g. Debug1, Debug2,..., Release1, Release2,...

You can copy the settings for the new configurations from a given one,
e.g. Debug.

Select a build configuration, then exclude the file containing main()'s
you don't want to use by clicking on the specific file and say
Properties. There go to C/C++ Build settings tab, select the build
configuration and mark the checkbox "Exclude from Build".

This is all for "Managed Make"-Projects, in standard make projects,
adapt your Makefile accordingly.

Fernando Barsoba schrieb:
> Hi all,
>
> I'd like to have several files with their correspondent main() functions
> under the same project. When I try to do it, I get the error 'multiple
> definition of main'. Could anyone tell me what paramtere do I have to
> change or how do I have to create the managed project?
>
> thanks,
>
> FBM
Re: Managed C project with several main() functions [message #157137 is a reply to message #157129] Mon, 31 October 2005 19:29 Go to previous message
Eclipse UserFriend
Originally posted by: fbarsoba.verizon.net

kesselhaus wrote:
> What does give the error? The CDT or the compiler/linker.
> I gues its the linker, which is normal if you compile multiple main's
> into one executable!
>
> Try if you can exclude one or the other file from the build process.
>
> Right now, the interface for the following is a little awkward.
> Create in the Project Settings multiple Build Configurations for each of
> the files with main(), e.g. Debug1, Debug2,..., Release1, Release2,...
>
> You can copy the settings for the new configurations from a given one,
> e.g. Debug.
>
> Select a build configuration, then exclude the file containing main()'s
> you don't want to use by clicking on the specific file and say
> Properties. There go to C/C++ Build settings tab, select the build
> configuration and mark the checkbox "Exclude from Build".
>
> This is all for "Managed Make"-Projects, in standard make projects,
> adapt your Makefile accordingly.

Thanks a lot. I've done it as you said.. and it works nicely..

FBM
Previous Topic:The CDT can not work!
Next Topic:why before launching external tools, eclipse will make the project again
Goto Forum:
  


Current Time: Fri Aug 16 21:36:07 GMT 2024

Powered by FUDForum. Page generated in 0.03354 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top