I'm using the Eclipse IDE for C++ (Eclipse CDT). I want to install the SFML library but I can't find what version of GCC my Eclipse uses.
Note: I have multiple GCC compilers (versions) installed on my computer.
Or how can I set up a different compiler for Eclipse to use?
FWIW,
to supplement the existing answer, "Look at your compiler's messages,"
and to address the first of the two questions, essentially, "What version/installation of GCC is Eclipse presently using?",
borrowing heavily from [https://www.jblopen.com/gcc-toolchain-eclipse-setup-guide-part-2/][JBLopen], and to render future access to that link less significant, a helpful place to start for finding the default path(s) to the toolchain(s) used by Eclipse is this:
"Window" (menu item) -> Preferences -> (under General is) C/C++ (expand to see) -> Core Build Toolchains.
This system presently shows five entries:
/usr/bin/gcc
/usr/bin/c99-gcc
/usr/bin/c89-gcc
/usr/bin/x86_64-linux-gnu-gcc
/usr/bin/clang
Also, under Properties (menu item) (or File -> Properties, when the Project Name is selected in that "view"), -> C/C++ Build (expand to see) -> Tool Chain Editor. This doesn't give paths, but it provides clues as to which tools are being used. (If, in studying those, one clicks "No ToolChain" and can't get the drop-down list back, just click "Cancel," and that drop-down list will be available, again.)
Also, another clue, not directly a path, but a clue, in this Linux set-up, comes from Properties -> Linux Tools Path. which, for these current settings, indicates "Use the System Environment PATH".
Just to touch on the second question, there are processes for installing other compilers and toolchains. That part is findable via web search. Once another compiler, etc., is installed, back under Window -> Preferences -> C/C++ -> Core Build Toolchains, Eclipse provides a way to add User Defined Toolchains.
Linux 18.04
Eclipse (C/C++) 2019-03
You can check the -v (verbose) flag on in the project options, then compile any file. It'll cause gcc to print a lot of additional information as output, including version e.g.: gcc version 7.2.0. It also includes library search paths which should help you deduce where your compiler is located.
This flag is located under project properties -> C/C++ Build -> Settings -> Tool Settings (tab) -> Selected compiler -> Miscellaneous -> Verbose (-v).
As for which compiler is selected - it is generally taken from your PATH. System path is read by Eclipse upon startup. You can then go ahead and modify it by hand either on workspace level (Window -> Preferences -> C/C++ -> Build -> Environment) or on project level, for example if you wanted to use different compiler versions for different projects. The approach I use is to make sure that path to my toolchain is not added to system PATH and I add it by hand on the workspace level.
I have a self contained project where every included file is within the project itself.
In the project properties -> "C/C++ General" -> "Preprocessor Include Paths, Macros etc." -> "Providers" I disabled the entries I don't need, but something re-enables the "CDT Cross GCC Built-in Compiler Settings".
Is there a way to permanently disable this option?
I want to keep the indexer working, and also I have some entries in the CDT managed build entries so its not an option to get rid of the build configuration (I do not build/start the build of the project from Eclipse).
The automatically added includes conflicts with the files within my project messing up the indexer (it adds the MinGW includes).
I am using Eclipse Oxygen on Windows 7.
I'm using Eclipse Kepler for C++, and I'm trying to update to C++11.
I've found that appending "-std=c++11" under C/C++ Build -> Settings -> Miscellaneous -> Other Flags will enable a specific project to run C++11. However, I have not been able to find a way to default this operation whenever a new project is created.
Is there a one-time setting that automatically sets a new C++ project to C++11? Thanks for letting me know.
I just install CDT plugin in Eclipse. When i start a project by click New menu in Eclipse, it shows lots of C/C++ project type:
such as: Executable/Excetuable(XL UPC)/Shared Library/Shared Library(XL UPC)....
What's different between them?
These are essentially "presets" - they have slightly different default build settings. E.g. shared library will pass the linker settings to emit .so instead of executable, XL UPC projects use compiler different then GCC by default, etc.
These settings can be changed after the project is created - but it may require a good understanding of CDT.
I went to Project->Properties->C/C++ General->Paths and Symbols and indeed the paths are the ones of my old mingwin install. My question is : is there an easy way to tell eclipse to reset the toolchain - for the workspace not per project ? Of course when I installed the CDT having already mingwin in my PATH I did not configure anything manually and I'd like to avoid it now
Thanks
Found an answer here. Go to Project > properties > C/C++ General > Paths and Symbols > GNU C++ - you will notice the paths point to old installation. Clear them in Project > properties > C/C++ Build > Discovery Options > GCC C++ Compiler and press the Clear button in the Automated discovery of paths and symbols box by the Clear discovered entries now label.
Rebuild your project.
Valid for Eclipse Juno.
If someone could explain how to do this not on a per project basis but for the whole workspace (the clean up of the settings) it would be much appreciated (and accepted). The paths are hardcoded in ${workspace_loc}\.metadata\.plugins\org.eclipse.cdt.make.core\<project_name>.sc files - the usual total epic mess with eclipse prefs being scattered all over the place - grr. Would the answer to my original question be to search and replace the paths there (and only there ?) ?
EDIT : Of note are the items in Project > Index menu - maybe a more appropriate way to do the same thing ?
The settings changed in release 8.1 (Eclipse Juno) and can be set globally for all projects. At least that's what they advertised.
In Window > Preferences > C/C++ > Build > Settings, select CDT GCC Built-in Compiler Settings MinGW then Clear Entries and Reset. In my version (CDT 8.2, Eclipse Kepler), the project specific settings Discovery Options does not exist anymore.
Some links about this:
http://wiki.eclipse.org/CDT/User/NewIn81#Scanner_Discovery
http://wiki.eclipse.org/CDT/User/FAQ#What_is_a_Scanner_Discovery.3F
In my specific case, it did work but no for everything, and not for the most important the Path and Symbols settings. I had to manually edit the <project_name>.sc file in the workspace.
Hope this helps someone else.
Matt