How to setup a linux C++ project in Eclipse? - c++

I have an existing C++ project on a linux environment, and would like to import it into the Eclipse IDE.
Not sure if I should start a new Eclipse C++ project, or if there was some way to import the source files?

You can create a new Eclipse C++ project "in-place", i.e. if you have your sources checked out at /home/joe/mysources, you can select that directory in the new project wizard (uncheck the "use default location" checkbox first). All your source files will show up in the Eclipse project.

one solution: just create a new C++ projet (Standard make project), checkout/copy your files in it, then right clic on the directory of the project in the ressource view and choose New > Other > C++ > Convert to C/C++ Make project.

Related

Importing C++ project to Eclipse - overlaps workspace

I have a project that I generated using make and C++ files using Unix. I want to import it to Eclipse, but get the message:
/workspace/Arthur/cmake/nuclear overlaps the workspace location: /workspace/Arthur/cmake/nuclear
Even when I try to set the location to /workspace/Arthur/cmake/, /workspace/Arthur, /workspace/, I get the same message that the location overlaps with /workspace/Arthur/cmake/nuclear
What should I do?
An eclipse workspace for an existing project should not be in the same location as the code. The eclipse workspace directory will contain information that eclipse needs to manage your workspace, not necessarily the source code. The solution is to create the workspace in an empty location. Then import the project using File->Import->Existing Code as Makefile Project. Once you import the project, right click on the project in the Project Explorer and go to properties->C/C++Build and update the 'Build Location' to be the folder that you normally use to make the project.

Eclipse CDT Kepler Importing Makefile project

I would love to import a Makefile project from Eclipse, and have all the different includes path that the compiler uses to create correctly my Eclipse project.
Unfortunately, those path, specified on the command line by a "-I" don't show up in Project Explorer and I have to add them by hand.
I am currently importing the project using the standard "Import project from Makefile" built in Eclipse.
If I'm not wrong there was an autodiscovery option in older versions of Eclipse, but it's not there anymore.
How do you do for having all your include paths set up without too much hassle?
The trick is NOT to use
File->New->Makefile Project with Existing Code
but to use
File->New->C++ Project
and then to select
Makefile project->Empty project.
After you set up such a dummy project, you simply copy your existing source to that project directory, hit F5 (i.e. Refresh) and change the build command to use your Makefile.
I was able to get this to work using Luna. I imported using File->New->C++->Makefile Project with Existing Code.
Prior to launching eclipse, you have to be sure to source any files that set required environment variables.
I did have some build options which were not the standard all and clean, so I had to add those configurations individually.
source files to setup your environment.
Launch Eclipse
Import C++ Makefile project
Setup Build options.
Click the hammer.

Change existing Netbeans C++ project to Qt Application

I have an existing Netbeans C++ project I want to change to a Netbeans Qt- Application. Is there an easy way to do it or do I have to reimport all my classes?
I do not know of any way to change a netbeans project after it is created. I would just make a new Qt application project. Then you can right click on the project name and choose "add existing items from folders...". That will allow you to import a whole folder of code files at one time. I would copy all the code out of the old project folder and into the new project folder before adding them, so the project code is all at the same place. Hope this helps.

How can I transfer an eclipse project to a new computer?

I am new to C++ and Eclipse (with CDT plugin) and I want to transfer the small project I have written on my old computer to my new one. On the new machine, must I create a new project, new files for each corresponding file in the project, then copy and paste the source into these files, or is there a setting in Eclipse that would allow me to import the files in one go. I have been searching all of the menu items for something such as "import project" or "import files" but I cannot find anything. Is copy and paste the only solution? I am using Ubuntu 12.04.
First, create a new and empty Workspace.
Then open the File menu and select Import....
Here you'll find an option to import existing projects, which should work with the project file in your old/copied source directory.
Create project from existing source: When selected, you can specify the location from which the New Java Project Wizard will
retrieve an existing Java project. In this case the wizard will
analyze the existing project and set up the build path automatically.
Click on Browse... to browse for a location of an existing Java
project.
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-wizard-java-project.htm
The easiest way is to copy the complete workspace folder.

How to import C makefile project into eclipse or put in under eclipse

I have standard source code package under Linux which requires to run
./configure
make
to compile it (and it works ok).
Mostly these files are C/C++
Is it possible to put this project under Eclipse control? I wish to browse definitions etc...
UPDATE 1
I have Eclipse Indigo running on Ubuntu. It contains CDT of course.
When I choose File-Import, I see no matching option under C/C++. Under General I have Existing Projects into Workspace but I get No project are found to import if I point this wizard to my project root.
UPDATE 2
I have installed Eclipse with Ubuntu package manager. Probably this was wrong.
First run the ./configure to generate the Makefile.
After that, if you have CDT installed,just choose the option
"File->New->Makefile Project With Existing Code" and point to the directory where the Makefile is stored.
Create a new project, make sure to uncheck the "Use default location" option while doing so. Add your source tree path in the location field. Now select "Makefile Project" in the project types window.
In "builder settings" (Project>Properties), uncheck the "use default build command" and add:
make -f /<your project location/Makefile
If your makefile is named otherwise, you can change it here.
To run your application, add the application in Run Configurations. See full instructions here.
Don't say import.
Create a new C/C++ project using the New Project Wizard, and specify the "root folder" as a non-default location of the new project.
See the instructions here.
Read "Creating new projects from existing source roots"