Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - "This project is not a CDT project"

Tags:

c

eclipse

project

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:

  1. Set Eclipse worksapce to /Project/
  2. Create new C-Project with the name Software --> Now Eclipse integrates all Source files etc. into the Project
  3. 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.

like image 303
Toby Avatar asked Sep 09 '13 07:09

Toby


2 Answers

If you are importing an existing CDT project and see “This project is not a CDT project”, it could be that the project was created on an older version of Eclipse, and you need to:

  • Select the project in the Project Explorer tab,
  • Click File->New->Convert to a C/C++ project

This will add a new .cproject file, and you are then ready to go.

like image 104
mirams Avatar answered Nov 03 '22 10:11

mirams


When creating your new project you need to create it as a makefile project - it will then use make to build the project but setting build properties up needs to be via your makefile and the make invocation.

This link tells you how to create a makefile project:

To create a project:

Select File > New > Project.

When you create a new project, you are required to specify the project type. This project type will determine the toolchain, data, and tabs that the CDT uses/displays.

Select the type of project to create. For this tutorial, expand the C/C++ folder and select C++ Project. The C++ Project wizard opens. Click here to see an illustration.

By default, the CDT filters the Toolchain and Project types that currently display in those lists are based on the language support for the C++ Project wizard you selected for this tutorial.

In the Project name field, type HelloWorld. Leave the Use Default Location option selected.

Next, you want to select the type of project to create. In the New CDT Project Wizard, you can choose from the following project types: Executable - Provides an executable application. This project type folder contains three templates. Hello World C++ Example provides a simple C++ Hello World application with main(). Hello World ANSI C Example provides a simple C Hello World application with main(). Empty Project provides a single source project folder that contains no files. After you select this template, the result is a project with only the meta-data files required for the project type. You are expected to provide source files for the project's target. The makefile for the Executable project type is automatically created by the CDT.

  1. Shared Library - An executable module that is compiled and linked separately. When you create a project that uses a shared library (libxx.so), you define your shared library's project as a Project Reference for your application. For this project type, the CDT combines object files together and joins them so they're relocatable and can be shared by many processes. Shared libraries are named using the format libxx.so.version, where version is a number with a default of 1. The libxx.so file usually is a symbolic link to the latest version. The makefile for this project type is automatically created by the CDT.
  2. Static Library - A collection of object files that you can link into another application (libxx.a). The CDT combines object files (i.e. .o) into an archive (.a) that is directly linked into an executable. The makefile for this project type is automatically created by the CDT.
  3. Makefile Project - Creates an empty project without the meta-data files. This selection is useful for importing and modifying existing makefile-based projects; a new makefile is not created for this project type.
like image 33
Steve Barnes Avatar answered Nov 03 '22 11:11

Steve Barnes