Eclipse CDT Kepler Importing Makefile project - c++

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.

Related

How can I get "go to definition" working in a JUCE project?

I'm trying to get "go to definition" working for a JUCE project created with Projucer. I've tried both CLion and Visual Studio Code, but they can't seem to find definitions that live in the JUCE libraries.
I'm on Ubuntu. Is there a blessed path for this? I'm normally a vim user, but I'm willing to try any IDE.
I've just figured this out!
In VS Code go View and Command Palette and type C/C++: Edit Configurations (UI) which will take to the IntelliSense Configurations page. Under Include path, on a new line, specify the path to JUCE e.g. ~/JUCE/**.
Note: The two stars are needed to tell VS Code to look through subdirectories.
This will create a hidden folder .vscode in your project folder with this configuration.
You will need to repeat these steps for each project you make.
Definitions and code completion should now work.
To compile your code, in your project folder go Builds then LinuxMakefile and in a terminal run the command make. Finally, go to the builds folder and run your project ./exampleProject.
You need to add the JUCE/modules folder to your search path, not the top-level JUCE/ folder!
If you're using the Projucer, you'll also need to add the JuceLibrarySource/ folder to your search path.
What I ended up doing was using FRUT to convert my project from a Projucer project to a CMake project. CLion was able to understand the CMake project, and thus, the "go to definition" and autocomplete features started working.

How to create a C++ project in Eclipse CDT using existing source files and an existing CMakeLists.txt?

The title says it all: I have source files and a CMakeLists.txt for an existing C++ project. Now I want to create a project in Eclipse CDT using those files.
I want to be able to build the project with the "build" button from within Eclipse once I'm done, and I want to be able to use GDB.
I've used the CMake option to create Eclipse projects before, but it didn't always work flawlessly and I was told the CMake generator for Eclipse is supposedly outdated.
I know I could just create an empty project and then copy the source files into it, but what about the CMakeLists.txt? I want Eclipse to know how to build the project.
I'm new to Eclipse and there are like fifty ways to start a new project with or without existing source files, so some guidance would be greatly appreciated.

How to open existing C++ project with Eclipse?

I have two projects in C++ that I need to run and build both in Windows and Linux.
We are using Microsoft TFS for source control.
For windows we are using Visual Studio.
For Linux we are using Eclipse. (I don't have much experience with Eclipse)
I had managed to configure and build properly the projects in both platforms.
I checked in TFS the .cproject and .project from eclipse, so I can use it in another computer.
Now I am trying to get the projects in another Linux computer and I don't know how to do it.
I tried following this instructions, but I don't have my source code zipped.
Other places like here suggest creating a new project.
Isn't there a way to open an existing project in Eclipse similar to Visual Studio?
Do I have to create a new project? If so, how can I keep the configurations I did to be able to build the project so other developer can use them?
File > Import... > General > Existing projects into workspace
Don't select an archive file. Set the root directory to where your .project and .cproject files are located. Your project should show up in the list. Make sure you don't forget to check the checkbox in front of your project.
Committing eclipse project files to a version control system is perfectly fine as long as you don't use absolute paths in your project settings. Use environment variables to specify paths which differ between developer machines.

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"

More with eclipse cdt

What is done when we import an existing project(maybe a visual studio project)?
Which files are used for configuration?
Try this one, you may get some information.
Migrate Visual Studio C and C++ projects to Eclipse CDT
Eclipse manages files completely differently than Visual Studio, files are managed by Eclipse and placed into the project workspace. Adding existing files has the aggravating effect of copying the files from their location into the workspace. There are workarounds for this (adding a link to existing file, makefile-only projects) but the default is to copy files around.
This is great if your project is managed by Eclipse alone, not great if you want a VS project AND an Eclipse project for the same codebase.
I'm don't think you can import a VS project into Eclipse CDT, at least not the way you're thinking.
The files used for configuration are stored in (path to workspace)/.metadata, there are a LOT of files that change constantly and can contain absolute paths. Caveat emptor.
There is no explicit wizard for importing visual studio project files. What you import is a directory tree full of source code files. Basic information about this is worked out and stored in a file called .project, which contains the settings from Project/properties.
If, when you create or import the project, 'use default location' is specified, the tree is copied into a workspace directory. If not, it is left where it is.
If the project type is 'makefile project', the only real assumption is that there is some external command to be run to build the software. Project properties/C++ build can be used to specify this command - by default, it is 'make'.
DevStudio can export a makefile for one of it's projects - from the Project menu, select 'Export Makefile'. Or you can just write one by hand, or use some other build tool such as ant.
If all else fails, set the build command to 'cat' (e.g. from cygwin) and the build argument to the name of a file that contains the output log from however the software was built.
Eclipse itself has two kinds of projects - those with makefiles, and those that it manages itself.
Makefile projects have a separate make file that you generally write on your own.
Eclipse managed projects have a .project file that is used by the IDE to create make files on the fly, when you build your project.
Are you asking specifically for visual studio projects, or is that just an example?