Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Cross Compilation
Cross Compilation [message #182564] Fri, 19 January 2007 15:42 Go to next message
Eclipse UserFriend
Originally posted by: laurent.malvert.gmail.com

Hello everyone,


I'd like to know if anyone has any idea or clue how to do this...

I have a project that is aimed at developing two implementations of a
system for different platforms.

I divied my projet like this:
MyProject
-> src
RootNameSpace/
win/
unix/
common/
-> include
RootNameSpace/
win/
unix/
common/

But of course, when I compile it tries to compile with all the source
files and I get a redefinition of whatever is in win/ because it's also
defined in unix/.
I used compilation variables to be able to tell the compiler which include
to use [1], but it doesn't prevent it of trying to compile both .cpp
implementations.

[1] you now, something like with
<RootNameSpace/common/SubNameSpace/Class.h> containign something like the
following:
# ifdef WIN32
# include <RootNameSpace/win/SubNameSpace/Class.h>
# else
# include <RootNameSpace/unix/SubNameSpace/Class.h>
# endif




I am using a Managed Make project.


I figured I could try to eclude directories from the compilation but I
could not manage to do that.
Or I could try to create 3 separate projects and have
MyProject.win and Myproject.unix to both use the MyProject.common as a
reference.

Is that the way to go ?
how would you do something like that ?


Thank you very much in advance.
Re: Cross Compilation [message #182587 is a reply to message #182564] Sat, 20 January 2007 12:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asdf.dd.dd

Havn't tried excactly that...

non-optimal solution 1:
ifdef the source files also, that way it will not be redefined

idea 2:
what about making 3 projects in eclipse.
one for win, one for linux, one for the common libs
You would then set a dependency to the common lib in the win and linux
builds.



"Laurent" <laurent.malvert@gmail.com> skrev i en meddelelse
news:86c586c14153eb483d6b536901d8c78b$1@www.eclipse.org...
> Hello everyone,
>
>
> I'd like to know if anyone has any idea or clue how to do this...
>
> I have a project that is aimed at developing two implementations of a
> system for different platforms.
>
> I divied my projet like this:
> MyProject
> -> src
> RootNameSpace/
> win/
> unix/
> common/
> -> include
> RootNameSpace/
> win/
> unix/
> common/
>
> But of course, when I compile it tries to compile with all the source
> files and I get a redefinition of whatever is in win/ because it's also
> defined in unix/.
> I used compilation variables to be able to tell the compiler which include
> to use [1], but it doesn't prevent it of trying to compile both .cpp
> implementations.
>
> [1] you now, something like with
> <RootNameSpace/common/SubNameSpace/Class.h> containign something like the
> following:
> # ifdef WIN32
> # include <RootNameSpace/win/SubNameSpace/Class.h>
> # else
> # include <RootNameSpace/unix/SubNameSpace/Class.h>
> # endif
>
>
>
>
> I am using a Managed Make project.
>
>
> I figured I could try to eclude directories from the compilation but I
> could not manage to do that.
> Or I could try to create 3 separate projects and have
> MyProject.win and Myproject.unix to both use the MyProject.common as a
> reference.
>
> Is that the way to go ?
> how would you do something like that ?
>
>
> Thank you very much in advance.
>
>
Re: Cross Compilation [message #182653 is a reply to message #182587] Mon, 22 January 2007 14:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: laurent.malvert.gmail.com

Troels Thomsen wrote:

> Havn't tried excactly that...

> non-optimal solution 1:
> ifdef the source files also, that way it will not be redefined

I could try that.
But indeed, that's not optimal at all.


> idea 2:
> what about making 3 projects in eclipse.
> one for win, one for linux, one for the common libs
> You would then set a dependency to the common lib in the win and linux
> builds.

That's what I was suggesting in my post, but I couldn't manage to make
this work correctly.
Re: Cross Compilation [message #912857 is a reply to message #182653] Fri, 14 September 2012 09:40 Go to previous messageGo to next message
Mahesh Kedari is currently offline Mahesh KedariFriend
Messages: 3
Registered: September 2012
Junior Member
I am really sorry to re-invoke this tread. Just wanted to confirm if this issue is fixed by any chance? I don't want to go for Code changes. Rather, I want to modify a logic of dependency scanning. Is there any possible workaround?
Re: Cross Compilation [message #912864 is a reply to message #182564] Fri, 14 September 2012 09:54 Go to previous message
Mahesh Kedari is currently offline Mahesh KedariFriend
Messages: 3
Registered: September 2012
Junior Member
I am really sorry for re-invoking this discussion.
Has anybody fixed this issue? Or is there any workaround for this one?

My use case is as explained below.

test.c
#ifdef BIG
#include "big_endian.h"
#else
#include "little_endian.h"
#endif


When I build this file for the first time, it creates a dependency file test.d which contains entry for "big_endian.h" if BIG macro is not defined.
Now if I go to Managed Build Settings and add new macro "BIG" and try to build the project, everything gets built as expected, but dependency file test.d does not get re-generated or update. Due to this, my test.c will still depend of "little_endian.h" as far as a dependency scanning is concerned.

Hence when "big_endian.h" gets updated, my test.c does not get rebuilt.

Can anyone please help me for this issue?
Previous Topic:get the list of sources files which exist in eclipse project explorer using CDT
Next Topic:Remote debugging with eclipse
Goto Forum:
  


Current Time: Tue Apr 23 14:06:45 GMT 2024

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

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

Back to the top