Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Working with a single codebase for Windows and Linux
Working with a single codebase for Windows and Linux [message #192806] Thu, 07 June 2007 07:53 Go to next message
Eclipse UserFriend
Originally posted by: objectivedynamics.homail.com

I'm currently working on a project which will target both Linux and Windows.
For a number of reasons, We're using Eclipse/CDT for the linux builds and
Microsoft Visual Studio for the Windows builds.

Now, ideally, I'd like to keep the sources separate from build files,
project files etc so in the following tree structure, the Eclipse workspace
would only contain project settings, make files etc. Similarly the Visual
Studio workspace would only hold .sln and .vcproj files.
Finally, all source would be below the inc and source folders.

root
|
|----Eclipse workspace
|
|----Visual Studio workspaces
|
|----inc
|
|----src

No, MSVC has no problem at all working with this kind of structure - it will
let me reference source files anywhere on my file system.

However, I can't seem to find a way of having Eclipse/CDT let me do the same
thing. Or at least, not a way that I find acceptable.
The nearest thing I've found is to set up *links* from within the Eclipse
workspace to the files in inc and src. The problem with this is that when I
create a link within Eclipse, it seems to use an absolute path to link to
the source file e.g.
c:\somplace\someproject\src\foo.cpp

This creates havoc when the project is located on a different drive. Has
anyone got any suggestions as to how this can be achieved?

TIA,
MikeB
Re: Working with a single codebase for Windows and Linux [message #192830 is a reply to message #192806] Thu, 07 June 2007 10:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: claudius.link.gmail.com

I am not sure if this is what you meant by "links" from within Eclipse.

In the Project properties (at least in CDT 4.0.0 RC2)
C/C++ General -> Paths and Symbols -> Source location
choosing "Create / link folder" looks like it should do
what you want.
But there seems to be a bug. The "Variables.." button shows
no variables and you can't use them either (I tried ${workspace_loc})

In the "Library paths" tab it is possible to use variables.


MikeB wrote:
> I'm currently working on a project which will target both Linux and Windows.
> For a number of reasons, We're using Eclipse/CDT for the linux builds and
> Microsoft Visual Studio for the Windows builds.
>
> Now, ideally, I'd like to keep the sources separate from build files,
> project files etc so in the following tree structure, the Eclipse workspace
> would only contain project settings, make files etc. Similarly the Visual
> Studio workspace would only hold .sln and .vcproj files.
> Finally, all source would be below the inc and source folders.
>
> root
> |
> |----Eclipse workspace
> |
> |----Visual Studio workspaces
> |
> |----inc
> |
> |----src
>
> No, MSVC has no problem at all working with this kind of structure - it will
> let me reference source files anywhere on my file system.
>
> However, I can't seem to find a way of having Eclipse/CDT let me do the same
> thing. Or at least, not a way that I find acceptable.
> The nearest thing I've found is to set up *links* from within the Eclipse
> workspace to the files in inc and src. The problem with this is that when I
> create a link within Eclipse, it seems to use an absolute path to link to
> the source file e.g.
> c:\somplace\someproject\src\foo.cpp
>
> This creates havoc when the project is located on a different drive. Has
> anyone got any suggestions as to how this can be achieved?
>
> TIA,
> MikeB
>
>
Re: Working with a single codebase for Windows and Linux [message #192941 is a reply to message #192830] Sat, 09 June 2007 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: objectivedynamics.homail.com

"Claudius Link" <claudius.link@gmail.com> wrote in message
news:4667E291.1030007@gmail.com...
>I am not sure if this is what you meant by "links" from within Eclipse.
>
> In the Project properties (at least in CDT 4.0.0 RC2)
> C/C++ General -> Paths and Symbols -> Source location
> choosing "Create / link folder" looks like it should do
> what you want.
> But there seems to be a bug. The "Variables.." button shows
> no variables and you can't use them either (I tried ${workspace_loc})
>
> In the "Library paths" tab it is possible to use variables.

Thanks for the info Claudius.

I'm still using CDT 3.1.2 and there appears to be no such tab. So, would it
be fair to say that you don't know of a functional way to achieve what I'm
trying to do even in 4.0.0 RC2?

The thing that bothers me is that I think that I'd have the same sitiuation
if I were targetting Windows and Linux solely using Eclipse:

For example (at least in CDT 3.1.2) there is a place where I can specify the
"Artifact extension". It's in Project | Properties | C/C++ Build on the
"Build Settings" tab.
Now, by default, on linux, the build extention is blank so that I get an
executable of the form "MyApp". However, on Windows, it's set to "exe" which
means that I get an executable named like "MyApp.exe"

So, unless I'm mistaken (and I really hope that I am):

1/ No single Eclipse/CDT workspace can be made to work "naturally" for both
Linux and Windows
2/ Theres no clear and functional way of having two workspaces share the
same source files.

It's this second point that worries me the most.

Rgds,
MikeB
Re: Working with a single codebase for Windows and Linux [message #193074 is a reply to message #192830] Tue, 12 June 2007 09:07 Go to previous message
Eclipse UserFriend
Originally posted by: objectivedynamics.homail.com

"Claudius Link" <claudius.link@gmail.com> wrote in message
news:4667E291.1030007@gmail.com...
> In the Project properties (at least in CDT 4.0.0 RC2)
> C/C++ General -> Paths and Symbols -> Source location
> choosing "Create / link folder" looks like it should do
> what you want.
> But there seems to be a bug. The "Variables.." button shows
> no variables and you can't use them either (I tried ${workspace_loc})

I think I misunderstood your reply to me. I downloaded CDT 4.0.0 RC3 and
looked into your suggestions. You were right - it *does* do just what I
want - I'm not too bothered about the possible bug in its support for
variables.

Rgds,
MikeB
Previous Topic:C/C++ Search
Next Topic:File/project management issues
Goto Forum:
  


Current Time: Fri Aug 16 17:36:23 GMT 2024

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

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

Back to the top