Eclipse Question

Maybe belongs in an Eclipse forum on another site but the Momentics version we are using is from 6.3.2 days which makes the version of Eclipse about 10 years old now so not sure how much help I’d get.

I’ve been asked to turn our project into an Eclipse one for some new developers who are used to Eclipse/Visual Studio (I prefer building directly on QNX).

Our company SVN repository is setup as follows:

               OurProduct
                     |
  ------------------------------------
  |                  |               |
Windows           Common            QNX

with Common being C++ code shared between QNX/Windows.

In the top of the Windows folder lies the Visual Studio .sln file. In the top of QNX lies my master Makefile (with relative paths to access code in Common). I want to put the Eclipse .project/.cdtproject files in that same top QNX folder so its setup like the Visual studio .sln.

So I created a Workspace called OurProduct. I used svn to check out the Common and QNX folders (just as developers would expect to do).

I then started Eclipse and told it to create a new standard Make C project. First thing I noticed is it put the .project/.cdtproject files in the parent OurProduct folder. That’s not where I want them since they absolutely don’t belong there. I deleted the project.

I then went into the QNX folder and created the new standard Make C project there. Now the files are in the right place. But when I do File-Import Filesystem inside Eclipse it can’t import the Common folder. Oh, I can copy the contents of Common into QNX and have a new Common folder there and Eclipse is happy with that. But it won’t work for checking files back into svn because developers would have to manually copy changed files back to Common (which is error prone and sucks)

Googling around I saw there is supposed to be a virtual folder option. But my version doesn’t seem to have that so I can’t do that. I do have a link option to files in an existing system. I might attempt to use that but I fear the link is a hard link and not virtual so if on my machine it’s in C:\Tim\OurProduct will this link be hard coded to C:\Tim\OurProduct so that it’s useless on another developers machine or will it be pathed properly?

I can’t believe Eclipse requires you to have every file physically reside under the directory your .project/cdtproject files are in. Please tell me that’s not true.

TIA,

Tim

First thing I noticed is it put the .project/.cdtproject
Depends on where you open the “workspace”. Normally, the workspace is the toplevel directory and each project is a directory within the workspace directory. However - a project can be “outside” the workspace in a specific named location (probably can be “relative” path). The workspace directory will contain .metadata folder. Not sure where you want to put this in your scheme.

I then went into the QNX folder and created the new standard Make C project
If your make file builds from “QNX” (not “Our Product”) and uses relative paths, then you should be able to build from IDE project IF you use File/New C Project (NOT QNX C)/Makefile Project with project home of “QNX”. (You would replace any default “make” with your correct make file)

I put the workspace in the OurProduct folder (actually I created a workspace called OurProduct and then used svn to check out the Common and QNX folders into OurProduct). I do not envision checking in the workspace .metadata folder because my understanding is that isn’t the equivalent of the .sln file in Visual Studio because it contains a lot of developer preferences / customization’s for Eclipse. To me that means it’s not intended to be checked in plus it would once again violate the separation QNX/Windows/Common stuff in our repository.

I told Eclipse I want to create a project called ‘QNX’ and it creates the folder (or rather the folder is already there and it just adds the .project file stuff to it). I did as you say and created a New C project. I can in fact build quite nicely once I define my ‘all, release, configure, clean’ targets.

However, my original problem remains. I can’t ‘see’ any files in Common. The Makefile complies as I said but because nothing in Common is in the QNX project you can’t see any files there (which sometimes will need to be edited). This is where I tried to ‘import’ filesystem and select Common but that’s where Eclipse insists on copying the files from Common under QNX so I have 2 copies of the source files. What’s worse is those copied files don’t get built nor do they get checked back in to svn. This is an absolute no go for me.

At the moment I have created multiple projects in my workspace, one for QNX, one for Common (in reality Common is made up of 3 folders so I have 4 total projects). Now I see the files and they aren’t copied anywhere. But I have useless .project files under Common that I now have to check back in to svn that I’d really like to avoid because why would Windows users want to see .project files from Eclipse in the Common area? This is the crux of my problem because Eclipse seems brain dead in that there doesn’t seem to be a way to add source files to a project that aren’t copied locally under the QNX folder (where the .project folder lies).

One last question about building under Eclipse. We are using the Poco open source libraries. On my QNX machine when I built the code I did a Make Install. This put the include files under ‘/usr/local/include/Poco’ and the libraries under ‘/usr/local/lib’. Where does this go under Eclipse?

I installed under D:/QNX630. I see a target/qnx6/usr folder and I tried there. I also tried target/qnx6/x86/usr. Lastly I tried /host/win32/x86/usr. Despite putting the includes there I continue to get File not found errors (Makefile uses -I/usr/local/include and this works just fine on QNX). So where are 3rd party libraries meant to be installed/placed for Eclipse? Do I need to specifically add the include path in my individual projects?

Tim

However, my original problem remains. I can’t ‘see’ any files in Common
Under Properties/C/C++ General/Paths and Symbols you get a place to enter as many include directories as you wish… i.e. “Common”. No need to copy files anywhere.

Make Install… Where does this go under Eclipse?
Since you are on windows ( D:/QNX630 ? ), why would you “install” anything? You are cross-compiling and the binaries/libraries produced belong on a QNX target. If you decide on a “standard” deployment area, you could modify “make install” to put them there. Otherwise, just leave them where they are created as outputs from the build process.

I think there is some confusion here on what I mean when I say ‘see’ the files.

Review my original setup where I have a QNX folder and a Common folder. Let’s say under QNX I have just 2 files: foo.cpp and Makefile. Under Common I have just 1 file: bar.cpp.

I create my project called QNX (in QNX folder) and import the files there. I see in the Project view window in Eclipse, foo.cpp and Makefile. So I can edit both those files in the Eclipse editor. I can also build (including bar.cpp) because my Makefile knows how to do this thanks to relative pathing so the build process works 100%. Now I want to edit bar.cpp (and by extension also see it in the Project view in Eclipse). How can I do this?

I see only 3 ways to do this:

  1. Import the Common folder to the QNX project in which case Eclipse insists on copying Common under QNX so I have a duplicate copy of Common (and bar.cpp) under QNX which won’t build because my Makefile doesn’t look for it there nor does svn expect it there either.
  2. Add a hard link in the QNX project to an external folder (Common in my case). This lets me see the Common folder but the hard link gets saved as ‘D:\QNX630\workspace\MyProject\Common’ which means any other developer must also use the exact same paths as me.
  3. Create a 2nd project called Common in my workspace. This leaves the files where they are and I can see bar.cpp. However I have useless .project/.cdtproject files in Common that aren’t used for anything. In addition to that annoyance is the inconvenience of having to import multiple projects (2 in my example) into your workspace (and how do you know if you have them all if you are a new developer) to see every file in the editor. Plus any attempt to build Common fails because there are no targets defined (this is less of an issue since it’s easy to explain you only build QNX).

#1 and #2 are unpalatable solutions. I can live with #3 if I absolutely have to but would ideally like to find a way not to have to have those extra .project files littering folders all over the place simply because Eclipse is brain dead. But how would multiple projects affect target debugging on a QNX target machine from Eclipse if you are trying to debug a running task where the files used to create it are spread over multiple projects (ie can you step through the source over multiple projects making up one executable?).

Got it.

One more question I forgot to ask yesterday

I see lots of these errors being reported during my build process:
D:\QNX630\host\win32\x86\usr\bin\sh.exe: *** heap allocated but not at 0x820000
0 [main] sh 10280 sync_with_child: child 8140(0x190) died before initialization with status code 0x1
10 [main] sh 10280 sync_with_child: *** child state waiting for longjmp

and eventually this comes up
C:/Users/tsowden/AppData/Local/Temp/make114682.sh[1]: cannot fork - try again

What does all this mean?

Tim