Invalid toolchain error with Code::Blocks

…衆ロ難τιáo~ 提交于 2019-12-21 21:40:11

问题


"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 XcodePreferencesDownloadsComponents, 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:


  1. Go to Settings->Compiler and Debugger->ToolChain Executables
  2. In Compilers installation directory, browse and select your MinGW installed Directory
  3. Also for C compiler, browse and go to bin folder which is inside MinGW and select mingw32-gcc.exe
  4. For C++ compiler, select mingw32-g++.exe from there
  5. For Linker for dynamic libs , select mingw32-g++.exe from there
  6. For Linker for static libs, select ar.exe from there
  7. For Debugger, select gdb.exe from there
  8. For Resource Compiler, select windres.exe from there
  9. For Make program mingw32-make.exe from there

thats how it worked for me



来源:https://stackoverflow.com/questions/11170241/invalid-toolchain-error-with-codeblocks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!