Understanding the Eclipse CDT projects - eclipse-cdt

I want to commit my CDT project to SVN. I am a newbie regarding CDT, and I'd like to know the files describing the project.
The concerned files seem to be :
.project
.settings (directory)
.cproject
.csettings (directory)
What are the purposes of .project and .settings ?
.project just include references to XML files stored in the .csettings directory. Some of my co-workers on other projects don't have this .csettings directory : everything is in the .cproject file. Are there some project properties which could make Eclipse delegates all the CDT settings in XLM files in the .csettings directory ?
And what about .csettings ?
Extra question : what is the .directory ?

.project is where Eclipse starts whenever it opens up the project: it tells the workbench what plugins are needed.
.cproject contains the settings specific to the CDT: your project's choice of build configurations, toolchains, individual tools and so on.
.settings can be used by individual plug-ins to store their own project-level preferences.
I've never come across .csettings...

.CPROJECT: This will contain all the settings provided for the particular selected Toolchain. For example, if the project needs to be created with gcc, then this .cproject file will contain all the compiler, linker options used by gcc.
Also if any boot-able files located within the project needs to be excluded that too will be specified here. In general it acts as a make to your project.
.PROJECT: Eclipse uses inbuild make file for linking the object files. This .project file will contain all the builder information (managebuilder).
.SETTINGS: This will contain the debugging information's for the selected toolchain. Like how the "COMPILER\ASSEMBLER\LINKER" includes are separated, eg., by means of ";" like that.

Every eclipse project has a .project file, general project settings (like the name of the project) go here
The .cproject file is where the CDT project specific settings go.
I'm not sure what the .settings and .csettings directories are for. Probably for project specific settings that can't be added to the .project and .cproject files.
On unix files (and directories are just a special type of file in unix) that begin with a . are hidden files.

Related

Visual Studio C++ how to add header files in a prefix folder

I cloned a github C++ repository. The repository is not a VS project. So I manually created a VS C++ blank project and added the files from the repo to the project. The files are not copied. This is not the problem.
The repo directory looks like this:
include\NTL\*.h
src\*.cpp
*.h means a bunch of header files and *.cpp means a bunch of .cpp source files.
The problem is that the .cpp files have #include <NTL/*.h> and when I build, VS fails to locate the header files (No such file or directory). Adding the path to the include to the Include Directories in project properties didn't help.
EDIT: After some experimenting, I've found that the error has nothing to do with the prefix NTL in #include <NTL/*.h> but with whether the files are copied into project directory. Even though the files appear in VS project view, they must be copied into the project directory.
EDIT: The only way I've managed to get the project to compile is to put the whole NTL directory containing header files in project directory. Include Directories and Additional Include Directories in project properties don't seem to have any effect.
All previous No such file or directory errors were the result of some combination of:
Mismatching project properties Configuration and Platform
Some .h files were actually missing from NTL github repo, e.g. mach_desc.h.
The solution to the problem consists of the following:
Under project Properties > C/C++, add the path to the include to Additional Include Directories.
VS project has a separate set of properties for each combination of Configuration and Platform. Make sure that step 1 applies to the active Configuration and Platform. E.g. If the project's currently configured to build for Debug x64 (active Configuration:Debug and Platform:x64), make sure that step 1 applies to Debug x64, and not something like Release Win32 or Release x64, etc.
Use the Windows/Linux-specific zip package from the Downloads page of the official website https://libntl.org/download.html

How to create a simple CLion C++ CMake project with different locations for Project itself, build products and source files

I'm new with CLion and CMakeList. I'd like to have different locations for:
CLion project files
Build Files
Source and Header Files
When opening default projects all are located under the same directory tree
What are the steps to create such project ('Hello world')?
CLion project files
AFAIK, you can only set one global path for each jetbrains' IDE, by writing IDE_HOME\bin\idea.properties file.
Details can be found here.
Build Files
Settings -> Build, Execution, Deployment -> CMake -> Generation path
You can also set several paths for different build profiles there.
Source and Header Files
Add sources and include directories in CMakeLists.txt .

Netbeans ignoring files

In Netbeans when I create a new C++ project from existing sources only the Makefile appears to be under Git version control. The other files (.h, .cpp) all appear to be ignored (grayed out) when viewing from the Projects or Files windows in Netbeans.
How do I make these files tracked?
I have already tried the right-click unignore option.
I do not have a .gitignore file at this point.
You can ignore files in git in other ways than using the .gitignore.
In project folder check the file .git/info/exclude - you can exclude files which yu don't want to keep in .gitignore (which is usually shared with other coders)
You can also ignore files on a global level. Check the settings of Netbeans - it might have a global ignore list used by git.

Project files in KDevelop

I am trying to use KDevelop to write a cmake based simple application. KDevelop created two myProject.kdev4 project files: one in the project folder and one in .kdev4 hidden subfolder. Both are non-empty. Which ones should I check in? How can I make kdevelop use just one project file (and preferably not use hidden folders)?
The .kdev4 file is used for kdevelop specific information (It mainly only tells KDevelop to use the CMake project manager). The folder includes user specific configuration (If you are familiar with Visual Studio, it is like the .user files).
Usually only the CMakeLists.txt files are needed as they should have all the relevant generic data. You can throw in the .kdev4 file so that you don't need to 'import' the project through the CMakeLists.txt on another machine. But the .kdev4 folder should stay in your local machine, as you don't want to mix user's configurations.

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?