Issue
I have existing C-Code and an existing Makefile, which I want to wrap into an Eclipse C-Project (Using Eclipse 3.4 Ganymede). The Code is organized like this:
Main Directory: /Project/Software
Source and Headerfiles: ../Project/Software/CodeDir1 ../Project/Software/CodeDir2
etc..
So far I have been doing these steps:
- Set Eclipse worksapce to /Project/
- Create new C-Project with the name
Software
--> Now Eclipse integrates all Source files etc. into the Project - Go to Properties -> C/C++ Build and set to "Custom Build options"
First time I do this, everything works fine. I get the output into my console and everything is cool. But then the "Build Icon" (The little hammer) is greyed out and I cant click it anymore. If I now go to the Project Properties -> C/C++ Build it just says "This project is not a CDT Project" and also I get an Error with a "java.lang.NullPointerException".
How can I get a working project?
edit:
To avoid a simple bug I tried the same with the new Version of Eclipse (Kepler). I get the same Error ("No CDT Project") but without the Null Pointer exception.
But I could narrow down the problem a bit: The first time I start the make process it always works. If the build process fails, I can still go to my Build Properties. As soon as I get one complete and error free build run, this issue occurs. Regarding this, it only happens when my make call is done from Eclipse. If I call it from the command line, I can still make one run out from eclipse.
Solution
The root of the problem is not located in Eclipse, it's in the makefile.
The directory structure of the whole Project is the following:
Project_Dir\Documentation\
Project_Dir\Output\
Project_Dir\Software\
Project_Dir\Tools\
The Source files are all located in the \Software\
directory. So I chose Project_Dir\Software\
as the project folder, which meant that the .project
and .cproject
files are located there.
The makefile itself temporarily writes the outputfiles in the \Software\
folder as well. In the end it copies all files from the Software
dir to Output
(practically a move *.* Project_Dir\Output\
command)
This command was also moving the Eclipse project-files, thus making it hard for eclipse to find them and open the project properties.
Two solutions:
- Change the project directory in eclipse to
\Project_Dir\
since it's all project related stuff anyway - Add two lines to the makefile: Before the move command:
attrib +r +s *.project
andattrib -r -s *.project
after the move command. (Same for.cproject
). This prevents the makefile from moving the files
Answered By - Toby
Answer Checked By - Robin (JavaFixing Admin)