问题
"Hello - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
I get the above message when I try to run a simple HelloWorld
program as below.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Any idea as to why this is happening and how I could solve it would be useful FYI : Im using the GNU GCC compiler at the moment, I tried changing this too but there was no use.
回答1:
Thanks to @Thrustmaster's comment. For anyone stuck with a similar problem in the future just go to Settings->Compiler and Debugger->ToolChain Executables ->Click Auto Detect on the compiler's installation directory
. Presto! The IDE auto-detects the path and works!
回答2:
Well, you could use a terminal (this assumes Linux or Mac OSX, and that GCC is installed):
g++ -o hello hello.cpp
Or, to install GCC on OSX, you have to install Xcode (the registration is free) and then go into Xcode → Preferences → Downloads → Components, and click on the install button next to "Command Line Tools".
To install GCC on Debian based Linux distros, use this: sudo apt-get install g++
.
回答3:
- Go to Settings->Compiler and Debugger->ToolChain Executables
- In Compilers installation directory, browse and select your MinGW installed Directory
- Also for C compiler, browse and go to bin folder which is inside MinGW and select mingw32-gcc.exe
- For C++ compiler, select mingw32-g++.exe from there
- For Linker for dynamic libs , select mingw32-g++.exe from there
- For Linker for static libs, select ar.exe from there
- For Debugger, select gdb.exe from there
- For Resource Compiler, select windres.exe from there
- For Make program mingw32-make.exe from there
thats how it worked for me
来源:https://stackoverflow.com/questions/11170241/invalid-toolchain-error-with-codeblocks