Why only one main per a C-project [message #214208] |
Thu, 17 April 2008 14:16 |
Eclipse User |
|
|
|
Originally posted by: markus.innerebner.net
Hi all,
Can somebody tell me, if there is a way to specify within CDT a C
project that contains several c files, where each file has a main function.
thanks a lot
Markus
|
|
|
Re: Why only one main per a C-project [message #214237 is a reply to message #214208] |
Thu, 17 April 2008 15:10 |
Eclipse User |
|
|
|
Originally posted by: Axel.Howind.htp-tel.de
Why would you want to do that in the first place?
If your project is a program - you can't.
If your project is a library - you can't.
It's a C restriction.
The only reasonable thing would be to have multiple programs and/or
libraries created during the build process. If so, there are 2 alternatives:
1) create one project per program/library - you can still have them all
in the same workspace.
2) write a makefile on your own.
Axel
markus innerebner schrieb:
> Hi all,
>
> Can somebody tell me, if there is a way to specify within CDT a C
> project that contains several c files, where each file has a main function.
>
> thanks a lot
>
> Markus
|
|
|
Re: Why only one main per a C-project [message #214284 is a reply to message #214237] |
Fri, 18 April 2008 02:00 |
Justin Clift Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Axel Howind wrote:
> Why would you want to do that in the first place?
>
> If your project is a program - you can't.
> If your project is a library - you can't.
> It's a C restriction.
No, I'm thinking he means to have a single project (i.e. folder), with
several separate applications developed/built in there.
I remember looking for how to do this when I first started using Eclipse
+ CDT too, and felt (at the time) that Eclipse was pretty brain damaged
to not have the flexibility for it. Heh. ;->
Makes me kind of wonder though, would it be possible to actually do this
by having a different C++ Build Configuration for each of the apps?
Configuring each of those configurations with a different build artifact?
i.e. Configuration 1: "Snowball"
Artifact -> "snowball"
Source File -> snowball.c (with it's own main())
Configuration 2: "Icestorm"
Artifact -> "icestorm"
Source File -> icestorm.c (with it's own main())
<etc>
?
Regards and best wishes,
Justin Clift
> The only reasonable thing would be to have multiple programs and/or
> libraries created during the build process. If so, there are 2
> alternatives:
>
> 1) create one project per program/library - you can still have them all
> in the same workspace.
>
> 2) write a makefile on your own.
>
> Axel
>
> markus innerebner schrieb:
>> Hi all,
>>
>> Can somebody tell me, if there is a way to specify within CDT a C
>> project that contains several c files, where each file has a main
>> function.
>>
>> thanks a lot
>>
>> Markus
--
Salasaga - Open Source eLearning IDE
http://www.salasaga.org
|
|
|
Re: Why only one main per a C-project [message #214312 is a reply to message #214237] |
Fri, 18 April 2008 09:33 |
Eclipse User |
|
|
|
Originally posted by: fwein.lse.eei.uni-erlangen.de
> 2) write a makefile on your own.
We have currently three mains, and it makes perfectly sense as it is
based on
the same code (main app, tool app, test app)
We use cmake to create makefiles and I find cmake pretty nice - works
smoothly with eclipse,
there is even a editor plugin.
Fabian
|
|
|
Re: Why only one main per a C-project [message #214319 is a reply to message #214312] |
Fri, 18 April 2008 10:04 |
Eclipse User |
|
|
|
Originally posted by: markus.innerebner.inf.unibz.it
Fabian Wein wrote:
>> 2) write a makefile on your own.
> We have currently three mains, and it makes perfectly sense as it is
> based on
> the same code (main app, tool app, test app)
>
> We use cmake to create makefiles and I find cmake pretty nice - works
> smoothly with eclipse,
> there is even a editor plugin.
>
> Fabian
Ok, great thanks for all your answers
So I will use cmake.
Markus
|
|
|
|
|
Re: Why only one main per a C-project [message #215183 is a reply to message #215104] |
Tue, 29 April 2008 18:23 |
Eclipse User |
|
|
|
Originally posted by: ag.xxx.com
ian scott-fleming wrote:
> I've been trying to figure this out myself.
> If it can't be done in eclipse with a managed make project, then what is
> the Make view for, and all the options in the make view such as "add make
> target".
> Seems like they are designed to allow multiple targets in one project
> without having to write the make file oneself. Unfortunately, I can't
> figure out how they are supposed to work, to do just that task.
Make View is rather to support existing makefile. If you have one, you can
run its targets from inside Eclipse.
|
|
|
Re: Why only one main per a C-project [message #215338 is a reply to message #214284] |
Thu, 01 May 2008 21:11 |
Eclipse User |
|
|
|
Originally posted by: dont.use.eml
Justin Clift wrote:
> Axel Howind wrote:
>> Why would you want to do that in the first place?
>>
>> If your project is a program - you can't.
>> If your project is a library - you can't.
>> It's a C restriction.
>
> No, I'm thinking he means to have a single project (i.e. folder), with
> several separate applications developed/built in there.
>
> I remember looking for how to do this when I first started using Eclipse
> + CDT too, and felt (at the time) that Eclipse was pretty brain damaged
> to not have the flexibility for it. Heh. ;->
>
> Makes me kind of wonder though, would it be possible to actually do this
> by having a different C++ Build Configuration for each of the apps?
>
> Configuring each of those configurations with a different build artifact?
>
> i.e. Configuration 1: "Snowball"
> Artifact -> "snowball"
> Source File -> snowball.c (with it's own main())
>
> Configuration 2: "Icestorm"
> Artifact -> "icestorm"
> Source File -> icestorm.c (with it's own main())
>
> <etc>
>
> ?
Unfortunately, that seems to break some functionality such as the C/C++
Indexer, the "//TODO" parser, etc.
I might be missing something - but whenever I "exclude" a file/folder
from the Release/Debug default build configurations, they become
effectively non-project files and I miss such functionality as mentioned
above.
|
|
|
Powered by
FUDForum. Page generated in 0.03438 seconds