For posterity I’m going to post my own solution to this problem. None of the answers above or on related StackOverflow questions helped; most referred to menu entries that didn’t exist, and the ones I could try did nothing. I searched other sites as well; there were about 6 different answers repeated many times, and none helped.
Short answer: I blew away the Eclipse install and replaced it. Then it worked. For me at least it wasn’t a project or configuration option (at least not one I could get to from the GUI); something in the Eclipse program folder had gotten tweaked and only a new install could repair the problem.
I’m doing Android development using the «ADT» (Android Developer Tools) build of Eclipse. I did something to the configuration that made it start giving the above error (actually two errors, for gcc and g++ both). And I tried plenty of potential solutions (in addition to my own searching for options that might help) with no success.
Thing is, I didn’t NEED gcc or g++ in the path. I’m doing Android development, and while both are used in the build process, I’m not using Eclipse to do the builds; I use the Android build system. And the C/C++ Build/Discovery options didn’t even give me an option for setting paths for gcc or g++. Other answers I found elsewhere referenced menu entries that don’t exist, and most seemed to be about helping people to use the normal C/C++ build within Eclipse, which I didn’t need to do.
So I used this opportunity to download the latest ADT package from Google, and then I ran the new one, importing the existing project into a new workspace (just in case the old workspace was corrupted or otherwise part of the problem). No more annoying gcc/g++ error.
The «G++ not found in Path» error is a common issue encountered by developers using the Eclipse IDE for C/C++ development on Windows. This error occurs when the Eclipse IDE cannot find the G++ compiler in the system’s PATH environment variable. In this guide, we will walk you through the steps to troubleshoot and resolve this issue.
Table of Contents
- Prerequisites
- Step 1: Install the G++ Compiler
- Step 2: Add the G++ Compiler to the System PATH
- Step 3: Configure Eclipse for the G++ Compiler
- Step 4: Verify the G++ Compiler Configuration
- FAQ
Prerequisites
Before proceeding with the troubleshooting steps, ensure that you have the following installed on your system:
- Eclipse IDE for C/C++ Developers
- MinGW or Cygwin
Step 1: Install the G++ Compiler
You will need to have the G++ compiler installed on your system to use it with Eclipse. You can install the G++ compiler using MinGW or Cygwin.
For MinGW:
- Download the MinGW Installation Manager.
- Run the installer and choose a directory to install MinGW (e.g.,
C:\MinGW
). - Open the MinGW Installation Manager, select the «mingw32-gcc-g++» package, and click on «Mark for Installation.»
- Click on the «Installation» menu and choose «Apply Changes.»
- Wait for the installation to complete.
For Cygwin:
- Download the Cygwin Setup.
- Run the installer and choose a directory to install Cygwin (e.g.,
C:\cygwin64
). - In the package selection screen, search for «gcc-g++» and select the «gcc-g++» package.
- Proceed with the installation.
Step 2: Add the G++ Compiler to the System PATH
After installing the G++ compiler, you need to add its location to your system’s PATH environment variable.
For MinGW:
- Locate the
bin
directory inside your MinGW installation (e.g.,C:\MinGW\bin
). - Right-click on «Computer» or «This PC» and choose «Properties.»
- Click on «Advanced system settings.»
- Click on «Environment Variables.»
- Under «System variables,» find the «Path» variable and click on «Edit.»
- Add the MinGW
bin
directory to the «Path» variable by appending;C:\MinGW\bin
at the end of the existing value. - Click «OK» to save the changes.
For Cygwin:
- Locate the
bin
directory inside your Cygwin installation (e.g.,C:\cygwin64\bin
). - Follow steps 2-7 from the MinGW instructions, but use the Cygwin
bin
directory instead (e.g.,;C:\cygwin64\bin
).
Step 3: Configure Eclipse for the G++ Compiler
Now that the G++ compiler is in your system’s PATH, you need to configure Eclipse to use it.
- Open the Eclipse IDE.
- Go to «Window» > «Preferences.»
- Expand the «C/C++» category and click on «New C/C++ Project Wizard.»
- Under «Preferred Toolchains,» ensure that «MinGW GCC» or «Cygwin GCC» is selected, depending on which one you installed.
- Click «OK» to save the changes.
Step 4: Verify the G++ Compiler Configuration
To verify that the G++ compiler is properly configured, create a new C++ project in Eclipse and build it.
- Go to «File» > «New» > «C++ Project.»
- Choose a project name and ensure that the «MinGW GCC» or «Cygwin GCC» toolchain is selected.
- Click «Finish» to create the project.
- Right-click on the project in the «Project Explorer» and choose «Build Project.»
- If the build is successful, the G++ compiler is properly configured.
FAQ
How do I update the G++ compiler?
To update the G++ compiler, open the MinGW Installation Manager or Cygwin Setup, and follow the same steps as for the initial installation.
Can I use multiple versions of the G++ compiler with Eclipse?
Yes, you can configure different toolchains in Eclipse for different projects. However, you will need to manage the PATH environment variable accordingly.
Are there alternative C++ compilers I can use with Eclipse?
Yes, you can use other C++ compilers, such as the Microsoft Visual C++ compiler or LLVM/Clang. However, these may require additional configuration within Eclipse.
Can I use the G++ compiler with other IDEs?
Yes, the G++ compiler can be used with other IDEs, such as Visual Studio Code, Code::Blocks, or CLion. Each IDE may have its own configuration process for using the G++ compiler.
Why is my G++ compiler still not found in the path after following these steps?
Ensure that the PATH environment variable is correctly set and that the G++ compiler is properly installed. If the issue persists, try restarting your computer or reinstalling the G++ compiler.
For more help, you can refer to the Eclipse CDT documentation or MinGW and Cygwin official documentation.
I have gpp installed in my Windows 7 (32 bit) as shown in the picture.
PATH variable gas g++
"%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\g++"
Still eclipse shows the error:
«Program «g++» not found in PATH».
How can this be resolved?
This question is related to
c++
c
eclipse
g++
The answer is
Today I have bumped into this problem and solved it in the following way. I pressed «Reset defaults» button everywhere I could find it in Eclipse settings (for example, Preferences/C++/Build/Settings/Discovery). After that the error disappeared and the code compiled successfully.
This is how I got rid of it:
- Install the MinGW.
- Select all files in the Basic Setup and select apply the changes.
- Select new C++ Project You will be able to see «MinGW GCC» in the toolchain section select the same and create project.
You need a gcc
, g++
compiler toolchain (on your windows machine) for the eclipse which you have manually downloaded,
One of the options can be done implicit via cygwin
installation(by selecting proper development packages for gcc
, g++
) and then add the location of the compiled gcc
,g++
package like C:\cygwin\etc\alternatives
to the PATH
variable for windows environment.
After this open eclipse and go to Project->properties->C/C++ Tool Chain Editor
and add replace default GNU C++ compiler
and GNU C Compiler
with Cygwin C++ compiler
and Cygwin C compiler
and rebuild the project. The errors related to gcc, g++ PATH not found
will now be gone.
You need:
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
in the PATH
.
and not
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\g++
as you wrote.
I had the same problem, the only solution that worked for me was this:
- Open command-line and check whether «g++» actually executes the compiler
- If (1) works, uncheck Project->Build automatically in Eclipse
- Clean project
- Build project
I got the same problem with mingw-64 (x86_64-4.9.1-release-posix-seh-rt_v3-rev1), Eclipse Luna 4.4.1 and CDT 8.5.0.201409172108, using Windows 7.
I solved this problem by putting the following two environment variables under
Window -> Preferences -> C/C++ -> Build-> Environment
- name: MINGW_HOME value: (mingw installation directory without «\bin»)
- name: MSYS_HOME value: (msys installation directory without «\bin»)
You can check
Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC
Built-in Compiler Settings MinGW [ Shared ]
, if it doesn’t complain «Toolchain MinGW GCC is not detected on this system» then you’re all set.
I had the same problem: Eclipse couldn’t find (g++) and (gcc) in PATH even they were accessible from command-line. I was also sure they are pointed by PATH correctly.
I have just deleted the (.metadata) folder from Eclipse’s Workspace as a mean to reset it and this worked for me.
The PATH
is locate at Project Properties > C/C++ Build > Environment (see screenshot below).
For your reference, I am using MinGW, I got the same error before I got the MSYS install. Later I found out that I also need MSYS to be install because the make.exe
wasn’t come with MinGW. (I don’t this error was cause be MSYS.)
After MSYS is installed, add MSYS and MinGW path into environment variable, restart Eclipse. Remember to rebuild your project in order to rectify the error. If error still persist after restart, recreate the workspace. At least this has solved the problem on my site, hopes this help on you too.
Good luck!
I had a similar problem. The error is raised, but the code is compiled and linked. The error was caused by the Error Parser using a different configuration than the one that is compiled.
The error parser configuration was only valid for the Linux configuration of my software. My active configuration was set for MinGW and Windows.
Solution:
- In Elipse under Windows->Preferences->C/C++->Indexer set Build Configuration for the indexer to Use active build configuration.
- Clean and rebuild, otherwise the old errors will remain visible
Maybe it has nothing to do here, but it could be useful for someone.
I installed jdk on: D:\Program Files\Java\jdk1.7.0_06\bin
So I added it to %PATH%
variable and checked it on cmd and everything was ok, but Eclipse kept showing me that error.
I used quotation marks on %PATH%
so it reads something like:
%SYSTEMROOT%\System32;"D:\Program Files\Java\jdk1.7.0_06\bin"
and problem solved.
I had similar problem and I solved it by:
Installing g++ The GNU C++ compiler using Ubuntu Software Center
Changing in: Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build in Complier Settings [Shared]
from: ${COMMAND} -E -P -v -dD «${INPUTS}»
to: /usr/bin/${COMMAND} -E -P -v -dD «${INPUTS}»
I hope it helps.
I had the same problem in Sublime..
- Right click on my computer
- Advanced system settings
- Environment variables
- in system variables, change path to location of ‘…\MinGW\bin’
Example: D:\work\sublime\MinGW\bin
For me it got fixed with:
Go to:
Window -> Preferences -> C/C++ -> Build -> Environment
Then press «Add…»
Name: MINGW_HOME
Value: C:\MinGW
(yours might be different if you choose a custom path)
Hit «Apply and Close»
Now, it shoud work if you did everything correctly
If you have your PATH setup and you can see g++ —version via the command line, then try to delete the project and create a new c++ project.
So the reset defaults might work but I think it has to update the PATH if it wasn’t added before.
Had this problem on windows 10, eclipse Neon Release (4.6.0) and MSYS2 installed.
Eclipse kept complaining that «Program ‘g++’ not found in PATH” and «Program ‘gcc’ not found in PATH”, yet it was compiling and running my C++ code.
From the command prompt, I could run g++.
Solution was to define the C++ Environmental variable for eclipse called ‘PATH’ to point to windows variable called ‘path’ also $(Path).
Menus: Preferences>>C/C++>>Build>>Environment
Looks like eclipse is case sensitive with the name of this environmental, while windows doesn’t care about the case.
The reason is that eclipse cannot find your gcc or g++ environment variable path.
You might have tried to run c
or c++
or fortran
but eclipse
cannot find out the compiler.
So, add the path in your environment variable.
-
Windows -> Search -environment variables -> click on environmental variables at bottom.
-
Click on path ->edit -> new -> your variable path
Path should be entire, for example:
C:\Users\mahidhai\cygwin64\usr\sbin
Make sure that the variable is permanently stored. It is not erased after you close the environment variables GUI.
Sometimes you might find it difficult to add a path variable.
Make sure windows is updated.
Even if Windows is updated and you have problems, directly go to the registry and navigate to the below.
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Add your path here. Remove any unnecessary repetitions of path variables.
Note:
You need to add your path variables in system environment variables -path
enter image description hereIf you just want to run C program but meet this error, it might mean that MinGw c++ compiler has not been installed even if «C:\MinGW\bin» has already been added to Windows Path variable.
Solution:
-
Run «mingw-get-setup.exe» to open MinGW Installation Manager
-
Open All Packages->MinGw->MinGW Base System->MinGW Compiler Suite
-
Select the following compilers to install:
. mingw32-gcc-g++
. mingw32-gcc-v3-core
. mingw32-gcc-vc-g++
-
Click Installation->Apply Changes to apply the above changes
-
Wait for the installation finishing(There might be some errors, just ignore them).
-
Restart Eclipse.
-
Done.
It Worked in my environment.
Hope it works in your case.
i think cgywin might not work for you as you can only compile your code in Win7 if you fire up the command prompt; you need to use MinGW compiler toolset instead. After you have install your compiler, go to Properties->C/C++ Build->Tool Chain Editor -> Change your current toolchain to MinGW GCC.
WINDOWS 7
If there is anyone new reading this, make sure to simply try a clean install of mingw before any of this. It will save you sooooo much time if that is your problem.
I opened up wingw installer, selected every program for removal, apply changes (under installation tab, upper left corner), closed out, went back in and installed every file (in «Basic Setup» section) availible. after that eclipse worked fine using «MinGW GCC» toolchain when starting a new C++ project.
I hope this works for someone else.
If not, I would do a reinstall of JDK (Java Developer’s Kit) and ECLIPSE as well. I have a 64bit system but I could only get the 32bit versions of Eclipse and JDK to work together.
First Install MinGW or other C/C++ compiler as it’s required by Eclipse C++.
Use https://sourceforge.net/projects/mingw-w64/
as unbelievably the download.cnet.com’s version has malware attached.
Back to Eclipse.
Now in all those path settings that the Eclipse Help manual talks about INSTEAD of typing the path, Select Variables and
**MINGW_HOME**
and do so for all instances which would ask for the compiler’s path.
First would be to click Preferences of the whatever project and C/C++ General then Paths and Symbols and add the
**MINGW_HOME** to those paths of for the compiler.
Next simply add the home directory to the Build Variables under the C++/C Build
Build Variables Screen Capture
In my case, I didnt mark for instalation the mingw32-gcc-g++ package in the installation manager, that’s why eclipse didn’t know it.
Needed to go to the instalation manager, mark it (in basic setup tab) and update catalogue
All the tips did not work for me using the Gaisler Tools for GR712RC Installation for OS RTEMS.
I’m using the Eclipse Kepler.
The simple way was making a copy of sparc-rtems-gcc.exe
to gcc.exe
, and sparc-rtems-g++.exe
to g++.exe
, in the C:\opt\rtems-4.10-mingw\bin
directory.
Questions with c++ tag:
• Method Call Chaining; returning a pointer vs a reference?
• How can I tell if an algorithm is efficient?
• Difference between opening a file in binary vs text
• How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure?
• Install Qt on Ubuntu
• #include errors detected in vscode
• Cannot open include file: ‘stdio.h’ — Visual Studio Community 2017 — C++ Error
• How to fix the error «Windows SDK version 8.1» was not found?
• Visual Studio 2017 errors on standard headers
• How do I check if a Key is pressed on C++
• How to enable C++17 compiling in Visual Studio?
• Remove from the beginning of std::vector
• Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly?
• What is (x & 1) and (x >>= 1)?
• What are the new features in C++17?
• Visual Studio Code includePath
• Compiling an application for use in highly radioactive environments
• «No rule to make target ‘install'»… But Makefile exists
• How to build and use Google TensorFlow C++ api
• Error LNK2019 unresolved external symbol _main referenced in function «int __cdecl invoke_main(void)» (?invoke_main@@YAHXZ)
• Converting std::__cxx11::string to std::string
• lvalue required as left operand of assignment error when using C++
• How to overcome «‘aclocal-1.15’ is missing on your system» warning?
• MSVCP140.dll missing
• How to get image width and height in OpenCV?
• CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
• Reading json files in C++
• What exactly is std::atomic?
• Compile c++14-code with g++
• Visual Studio 2015 doesn’t have cl.exe
• Visual Studio 2013 error MS8020 Build tools v140 cannot be found
• CMake does not find Visual C++ compiler
• Casting int to bool in C/C++
• C++ How do I convert a std::chrono::time_point to long and back
• How can I get the size of an std::vector as an int?
• Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);
• Fatal error: iostream: No such file or directory in compiling C program using GCC
• unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2
• How to end C++ code
• How to change text color and console color in code::blocks?
• Error: stray ‘\240’ in program
• invalid use of non-static member function
• Convert float to string with precision & number of decimal digits specified?
• enum to string in modern C++11 / C++14 / C++17 and future C++20
• Passing capturing lambda as function pointer
• How do I add a library path in cmake?
• error: expected primary-expression before ‘)’ token (C)
• undefined reference to ‘std::cout’
• java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader
• fatal error: mpi.h: No such file or directory #include <mpi.h>
Questions with c tag:
• conflicting types for ‘outchar’
• Can’t compile C program on a Mac after upgrade to Mojave
• Program to find largest and second largest number in array
• Prime numbers between 1 to 100 in C Programming Language
• In c, in bool, true == 1 and false == 0?
• How I can print to stderr in C?
• Visual Studio Code includePath
• «error: assignment to expression with array type error» when I assign a struct field (C)
• Compiling an application for use in highly radioactive environments
• How can you print multiple variables inside a string using printf?
• How to resolve the «EVP_DecryptFInal_ex: bad decrypt» during file decryption
• How does one set up the Visual Studio Code compiler/debugger to GCC?
• How to add a char/int to an char array in C?
• Fork() function in C
• Warning comparison between pointer and integer
• Unsigned values in C
• How to run C program on Mac OS X using Terminal?
• How to printf a 64-bit integer as hex?
• Casting int to bool in C/C++
• Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);
• «Multiple definition», «first defined here» errors
• error C4996: ‘scanf’: This function or variable may be unsafe in c programming
• Fatal error: iostream: No such file or directory in compiling C program using GCC
• What is the symbol for whitespace in C?
• How to change text color and console color in code::blocks?
• How to build x86 and/or x64 on Windows from command line with CMAKE?
• error: expected primary-expression before ‘)’ token (C)
• C compile : collect2: error: ld returned 1 exit status
• How to use execvp()
• What does «collect2: error: ld returned 1 exit status» mean?
• socket connect() vs bind()
• fatal error: mpi.h: No such file or directory #include <mpi.h>
• How to scanf only integer?
• Abort trap 6 error in C
• Can someone explain how to append an element to an array in C programming?
• Returning string from C function
• Difference between using Makefile and CMake to compile the code
• How to convert const char* to char* in C?
• C convert floating point to int
• «break;» out of «if» statement?
• How to compile and run C in sublime text 3?
• How do I use setsockopt(SO_REUSEADDR)?
• Reading string by char till end of line C/C++
• How to set all elements of an array to zero or any same value?
• The differences between initialize, define, declare a variable
• how to stop a loop arduino
• ‘readline/readline.h’ file not found
• size of uint8, uint16 and uint32?
• warning: control reaches end of non-void function [-Wreturn-type]
• Char Comparison in C
Questions with eclipse tag:
• How do I get the command-line for an Eclipse run configuration?
• My eclipse won’t open, i download the bundle pack it keeps saying error log
• strange error in my Animation Drawable
• How to uninstall Eclipse?
• How to resolve Unable to load authentication plugin ‘caching_sha2_password’ issue
• Class has been compiled by a more recent version of the Java Environment
• Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
• How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9
• «The POM for … is missing, no dependency information available» even though it exists in Maven Repository
• The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat
• Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start
• What does ‘Unsupported major.minor version 52.0’ mean, and how do I fix it?
• m2e error in MavenArchiver.getManifest()
• How to use Tomcat 8.5.x and TomEE 7.x with Eclipse?
• The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
• Setting the correct PATH for Eclipse
• java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries. spark Eclipse on windows 7
• Eclipse not recognizing JVM 1.8
• Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?
• Can’t import org.apache.http.HttpResponse in Android Studio
• web.xml is missing and <failOnMissingWebXml> is set to true
• Eclipse: How to install a plugin manually?
• How to solve maven 2.6 resource plugin dependency?
• Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse?
• Could not load the Tomcat server configuration
• «Multiple definition», «first defined here» errors
• Error loading the SDK when Eclipse starts
• org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start
• Spring Boot Program cannot find main class
• Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved
• How do I add a resources folder to my Java project in Eclipse
• Android Studio shortcuts like Eclipse
• Where can I download Eclipse Android bundle?
• Eclipse: Java was started but returned error code=13
• Eclipse — Installing a new JRE (Java SE 8 1.8.0)
• Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources
• Eclipse error «Could not find or load main class»
• Eclipse Java error: This selection cannot be launched and there are no recent launches
• Cannot create Maven Project in eclipse
• Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4
• This compilation unit is not on the build path of a Java project
• Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
• How to configure Glassfish Server in Eclipse manually
• The Import android.support.v7 cannot be resolved
• Why won’t eclipse switch the compiler to Java 8?
• Can’t fix Unsupported major.minor version 52.0 even after fixing compatibility
• There are No resources that can be added or removed from the server
• Error launching Eclipse 4.4 «Version 1.6.0_65 of the JVM is not suitable for this product.»
• Using android.support.v7.widget.CardView in my project (Eclipse)
• Update Eclipse with Android development tools v. 23
Questions with g++ tag:
• How do I set up CLion to compile and run?
• Compile c++14-code with g++
• Fatal error: iostream: No such file or directory in compiling C program using GCC
• How does #include <bits/stdc++.h> work in C++?
• DSO missing from command line
• C++ unordered_map using a custom class type as the key
• How do I enable C++11 in gcc?
• usr/bin/ld: cannot find -l<nameOfTheLibrary>
• cc1plus: error: unrecognized command line option «-std=c++11» with g++
• to_string is not a member of std, says g++ (mingw)
• How do I install g++ for Fedora?
• gcc/g++: «No such file or directory»
• How to make g++ search for header files in a specific directory?
• openCV program compile error «libopencv_core.so.2.4: cannot open shared object file: No such file or directory» in ubuntu 12.04
• Eclipse C++ : «Program «g++» not found in PATH»
• Is optimisation level -O3 dangerous in g++?
• C++ compile time error: expected identifier before numeric constant
• Compiling C++11 with g++
• C++ Error ‘nullptr was not declared in this scope’ in Eclipse IDE
• std::enable_if to conditionally compile a member function
• Using ‘sudo apt-get install build-essentials’
• How do I include a path to libraries in g++
• Link error «undefined reference to `__gxx_personality_v0′» and g++
• error: use of deleted function
• How to create a static library with g++?
• extra qualification error in C++
• How to see which flags -march=native will activate?
• error: expected class-name before ‘{’ token
• Error: free(): invalid next size (fast):
• Missing include «bits/c++config.h» when cross compiling 64 bit program on 32 bit in Ubuntu
• LD_LIBRARY_PATH vs LIBRARY_PATH
• C++ undefined reference to defined function
• How to forward declare a template class in namespace std?
• Compiling a C++ program with gcc
• Undefined reference to vtable
• What is the purpose of using -pedantic in GCC/G++ compiler?
• How to specify preference of library path?
• How do I capture all of my compiler’s output to a file?
• GCC dump preprocessor defines
• How do I install g++ on MacOS X?
• gcc warning» ‘will be initialized after’
• Disable all gcc warnings
• GCC C++ Linker errors: Undefined reference to ‘vtable for XXX’, Undefined reference to ‘ClassName::ClassName()’
• Update GCC on OSX
• How to make a variadic macro (variable number of arguments)
• Compiling with g++ using multiple cores
• g++ undefined reference to typeinfo
• Undefined reference to static class member
• What is the difference between g++ and gcc?
I have read all of the links I could find on stackoverflow but none of them actually contained a solution.
I am using Eclipse CDT and I have installed both cygwin64 and MinGW in trying to figure this out.
My paths seem to be correct, and I seem to be using the correct toolchains, but I still can’t seem to fix it.
MINGW_HOME Variable:
C:\MinGW
MSYS_HOME Variable:
C:\MinGW\msys\1.0
PATH Variable:
${MINGW_HOME}\bin;${MSYS_HOME}\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\
Thanks for your help!
19 ответов
Сегодня я столкнулся с этой проблемой и решил ее следующим образом. Я нажал кнопку Reset defaults «везде, где мог найти ее в настройках Eclipse (например, Preferences/С++/Build/Settings/Discovery). После этого ошибка исчезла, и код был скомпилирован успешно.
user1558573
Поделиться
Вот как я избавился от него.
- Установите MinGW.
- Выберите все файлы в базовой установке и выберите применить изменения.
- Выберите новый проект С++. Вы увидите «MinGW GCC» в разделе инструментальной цепочки, выберите тот же и создайте проект.
Shashank Saxena
Поделиться
Вам нужна инструментальная цепочка gcc
, g++
для компилятора (на вашей машине Windows) для eclipse, которую вы вручную загрузили,
Один из вариантов можно сделать неявным с помощью установки cygwin
(путем выбора правильных пакетов разработки для gcc
, g++
), а затем добавить расположение скомпилированного пакета gcc
, g++
, например C:\cygwin\etc\alternatives
, в PATH
для среды Windows.
После этого открытого затмения и перейдите к Project->properties->C/C++ Tool Chain Editor
и добавьте замену по умолчанию GNU C++ compiler
и GNU C Compiler
на Cygwin C++ compiler
и Cygwin C compiler
и перестройте проект. Ошибки, связанные с gcc, g++ PATH not found
, теперь исчезнут.
Peter_pk
Поделиться
Вам нужно:
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
в PATH
.
а не
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\g++
как вы писали.
ouah
Поделиться
У меня такая же проблема с mingw-64 (x86_64-4.9.1-release-posix-seh-rt_v3-rev1), Eclipse Luna 4.4.1 и CDT 8.5.0.201409172108, используя Windows 7.
Я решил эту проблему, поставив следующие две переменные среды в
Окно → Настройки → C/С++ → Build- > Environment
- name: значение MINGW_HOME: (каталог установки mingw без «\ bin» )
- name: значение MSYS_HOME: (каталог установки msys без «\ bin» )
Вы можете проверить
Окно → Настройки → C/С++ → Сборка → Настройки → Обнаружение → CDT GCC Встроенные настройки компилятора MinGW [Shared]
если он не жалуется «Toolchain MinGW GCC не обнаружен в этой системе», тогда вы все настроены.
WorldFS
Поделиться
У меня была та же проблема, единственным решением, которое сработало для меня, было следующее:
- Откройте командную строку и проверьте, действительно ли выполняет «g++» компилятор
- Если (1) работает, снимите флажок Project- > Build автоматически в Eclipse
- Очистить проект
- Проект сборки
theten
Поделиться
У меня была та же проблема: Eclipse не смог найти (g++) и (gcc) в PATH, даже они были доступны из командной строки. Я также был уверен, что они правильно указаны PATH.
Я только что удалил папку (.metadata) из рабочей области Eclipse как среднее значение для reset, и это сработало для меня.
M. Khaled
Поделиться
PATH
находится в области «Свойства проекта» > «Сборка C/С++» > «Среда» (см. снимок экрана ниже).
Для вашей справки я использую MinGW, у меня такая же ошибка, прежде чем я установил MSYS. Позже я узнал, что мне также нужно установить MSYS, потому что make.exe
не был включен с MinGW. (Я не эту ошибку был причиной MSYS.)
После установки MSYS добавьте путь MSYS и MinGW в переменную окружения, перезапустите Eclipse. Не забудьте перестроить проект, чтобы исправить ошибку. Если ошибка по-прежнему сохраняется после перезапуска, заново создайте рабочую область. По крайней мере, это решило проблему на моем сайте, надеется, что эта помощь тоже поможет вам.
Удачи!
huahsin68
Поделиться
У меня была аналогичная проблема. Ошибка возникает, но код скомпилирован и связан. Ошибка была вызвана ошибкой Parser с использованием другой конфигурации, чем тот, который был скомпилирован.
Конфигурация парсера ошибок была действительна только для конфигурации Linux моего программного обеспечения. Моя активная конфигурация была настроена для MinGW и Windows.
Решение:
- В Elipse под Windows- > Preferences- > C/С++ → Indexer установите для конфигурации индексации для индексатора значение Использовать конфигурацию активной сборки.
- Очистите и перестройте, иначе старые ошибки останутся видимыми.
JoR
Поделиться
У меня была аналогичная проблема, и я решил ее:
Установка g++ Компилятор GNU С++ с использованием программного обеспечения Ubuntu Software Center
Изменение в: Окно → Настройки → C/С++ → Сборка → Настройки → Обнаружение → CDT GCC Построение в настройках Complier [Общие]
from: ${COMMAND} -E -P -v -dD «$ {INPUTS}»
to:/usr/bin/${COMMAND} -E -P -v -dD «$ {INPUTS}»
Надеюсь, это поможет.
Akash5288
Поделиться
Может быть, здесь здесь нечего делать, но это может быть полезно для кого-то.
Я установил jdk на: D:\Program Files\Java\jdk1.7.0_06\bin
Поэтому я добавил его в переменную %PATH%
и проверил ее на cmd, и все было в порядке, но Eclipse продолжал показывать мне эту ошибку.
Я использовал кавычки на %PATH%
, поэтому он читает что-то вроде:
%SYSTEMROOT%\System32;"D:\Program Files\Java\jdk1.7.0_06\bin"
и проблема решена.
DamnHim
Поделиться
У меня была такая же проблема в Sublime..
- Щелкните правой кнопкой мыши на моем компьютере.
- Расширенные настройки системы
- Переменные среды
- в системных переменных, измените путь к местоположению ‘…\MinGW\bin’
Пример: D:\work\sublime\MinGW\bin
yasser alaa eldin
Поделиться
Все советы не работали для меня, используя инструменты Gaisler для установки GR712RC для ОС RTEMS.
Я использую Eclipse Kepler.
Простым способом было создание копии sparc-rtems-gcc.exe в gcc.exe и sparc-rtems-g++. Exe to g++. Exe в C:\opt\rtems-4.10-mingw\bin Directory.
Mike
Поделиться
Если бы эта проблема возникла в Windows 10, Eclipse Neon Release (4.6.0) и MSYS2.
Eclipse продолжал жаловаться на то, что «Программа» g++ «не найдена в PATH» и «Program» gcc «не найдена в PATH», но она собирала и запускала мой код на С++.
В командной строке я мог бы запустить g++.
Решение состояло в том, чтобы определить переменную среды С++ для eclipse под названием «PATH», чтобы указать на переменную Windows, называемую «путь», также $(Path).
Меню: Настройки → C/С++ → Сборка → Среда
Похоже, что eclipse чувствителен к регистру с именем этой среды, в то время как окна не заботятся об этом случае.
steve biko
Поделиться
Если у вас есть настройка PATH, и вы можете увидеть g++ —version через командную строку, попробуйте удалить проект и создать новый проект С++.
Таким образом, параметры reset могут работать, но я думаю, что он должен обновить PATH, если он не был добавлен ранее.
iosentinel
Поделиться
Сначала установите MinGW или другой компилятор C/С++, как это требуется Eclipse С++.
Используйте https://sourceforge.net/projects/mingw-w64/
так как невероятно, что версия download.cnet.com имеет вредоносное ПО.
Назад к Eclipse.
Теперь во всех этих параметрах пути, которые в справочном руководстве Eclipse говорится об INSTEAD о вводе пути, Выбрать переменные и
**MINGW_HOME**
и сделать это для всех экземпляров, которые будут запрашивать путь к компилятору.
Сначала нужно нажать Настройки любого проекта и C/С++ Общие, затем Контуры и символы и добавить
**MINGW_HOME** to those paths of for the compiler.
Затем просто добавьте домашний каталог в Сборка переменных в разделе С++/C Build
Сборка затвора экрана с экранa >
Light Bringer
Поделиться
В моем случае, я не заметил для установки пакета mingw32-gcc-g++ в менеджере установки, почему Eclipse этого не знал.
Необходимо перейти к менеджеру установки, пометить его (на закладке базовой настройки) и обновить каталог
Achi Even-dar
Поделиться
WINDOWS 7
Если кто-нибудь читает это, обязательно попробуйте выполнить чистую установку mingw перед любым из этого. Это сэкономит вам много времени, если это ваша проблема.
Я открыл программу установки, выбрав каждую программу для удаления, применил изменения (на вкладке установки, в верхнем левом углу), закрыл, вернулся и установил каждый файл (в разделе «Базовая установка» ). после этого затмение отлично работало с помощью инструментальной комбинации «MinGW GCC» при запуске нового проекта на С++.
Надеюсь, это сработает для кого-то другого.
Если нет, я бы сделал переустановку JDK (Java Developer Kit) и ECLIPSE. У меня 64-битная система, но я мог получить только 32-разрядные версии Eclipse и JDK для совместной работы.
Joel Stansbury
Поделиться
Я думаю, что cgywin может не работать для вас, поскольку вы можете компилировать свой код только в Win7, если вы запускаете командную строку; вам нужно использовать набор инструментов компилятора MinGW. После того, как вы установили свой компилятор, перейдите в «Свойства- > C/С++ Build- > Tool Chain Editor → Измените свою текущую инструментальную цепочку на MinGW GCC.
kepung
Поделиться
Ещё вопросы
- 0JQuery UI панель / портлет плагин решение
- 1Объяснение о клоне необходим массив, содержащий клонируемые объекты
- 0Simple_html_dom: как удалить все элементы со значением атрибута, кроме первого?
- 0Как отключить функцию .change при загрузке страницы
- 1SqlDependency не работает событие, если имеются очереди и запрос действителен
- 1Кнопка назад не работает в XAML / W8
- 1Понимание поведения тензорного потока при извлечении данных из двух разных источников данных с помощью набора данных API
- 0Как вставить скобки в имя столбца моей таблицы SQL?
- 0происхождение функции javascript [дубликаты]
- 0Как передать данные о значении в ссылку на действие
- 0Как сделать календарь всплывающим при нажатии на значок календаря?
- 1C # .NET 4.0 Перетаскивание между двумя приложениями
- 1tornado.httpclient.HTTPError: HTTP 599: время ожидания во время запроса
- 1Вывод типа с интерфейсами
- 0Выполнение запроса занимает много времени в AWS RDS
- 0MySQL запрос не работает в браузере
- 0ограничивающие элементы, когда я нажимаю больше, чтобы загрузить другие элементы
- 0Проверьте, существует ли уже УНИКАЛЬНАЯ строка, используя findBy в ManyToMany, какой-нибудь обходной путь или рабочее решение?
- 1Передача никогда не выполняется при остановке приложения
- 1Возможности перехода с Google+ Вход в Google Вход
- 0Способ загрузить все необходимые зависимости kde, чтобы начать работать над программированием kde?
- 1Зачем мне нужен try-catch с бросками в моем примере?
- 0Ionic Framework не показывает Google Maps
- 1Как передать только сообщения об ошибках из модели в контроллер (Mongoose)?
- 0URL со ссылкой на объект из ответа HATEOAS REST в AngularJS
- 1Угловая труба: невозможно заменить / n
- 0Объединение информации в одной таблице и перемещение ее в другую в MySQL
- 0Цвет фона панели навигации не занимает всю ширину
- 1Можно ли заставить div следовать другому элементу iside iframe, если содержимое iframe принадлежит той же области
- 0Как создать макет сайта с полным окном просмотра
- 1Как перенаправить пользователя на конкретную деятельность в Cloud Firestore?
- 0Какой класс / тип не определен, и возможно ли расширить / добавить метод к нему?
- 0JQuery флажок проблемы
- 1[Python Falcon]: gunicorn работает в терминале, но не в PyCharm
- 0Неожиданные результаты с преобразованием строк wchar_t и c_str
- 0SQL-запрос для поиска общих элементов в списках столбцов между таблицей и указанными критериями?
- 0MySQL JSON заменить строку в целое число
- 0Laravel 5.5 Получить порядок сообщений по сумме голосов
- 1Увеличение 3-го вхождения цифры в строку с помощью JavaScript
- 0Подсчет конкретных строк mysql + express
- 0Получить только строки, где встречаются все необходимые типы
- 0как удалить кнопки «одна страница», «две страницы»… «шесть страниц» в printpreviewdialog?
- 1Как отложить вызов в базу данных от gwt?
- 0Замена содержимого ячейки Jquery
- 0Можно ли передать значение из ng.repeat в функцию JavaScript?
- 0Инициализация базы данных Ghost при новой установке
- 0Выбрать количество из нескольких таблиц
- 1Как выделить таблицу строк, если дано условие?
- 1Как уменьшить / изменить задержку после сканирования?
- 1Как найти приблизительные координаты из четырех разных списков и координат