Author Topic: Environment error  (Read 17930 times)

Code.14

  • Guest
Environment error
« on: March 22, 2020, 11:42:39 am »
When I open my codeblocks apear this error message "Environment error-can't find compiler executable in your configured search path's for GNU GCC compiler". What this mean?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Environment error
« Reply #1 on: March 22, 2020, 11:47:07 am »
When I open my codeblocks apear this error message "Environment error-can't find compiler executable in your configured search path's for GNU GCC compiler". What this mean?

That you need to install a compiler or configure CB to use an already installed compiler.

Please read http://wiki.codeblocks.org/index.php/FAQ-General#Q:_What_Code::Blocks_is_not.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Eboy

  • Single posting newcomer
  • *
  • Posts: 2
Re: Environment error
« Reply #2 on: March 29, 2020, 05:26:22 pm »
the thing is, https://www.fosshub.com/Code-Blocks.html?dwl=codeblocks-20.03mingw-setup.exe This doesn't come with the mingw compiler suite. It says it does, but it's hard for us windows users to find the compiler. The article on the download page says it comes with mingw, but actually doesn't. A work around is to download strawberry perl, but the pathing may mess up the computer IDK for sure to be honest about strawberry perl. Eitherway, it does seem that there's an issue with the installer itself when I click on the full installer and we still can't seem to find the GCC compiler on windows. Pathing may help, but I didn't get any compiler identified when configuring codeblocks fort the first time.

Also, the wiki is quite old, it's still saying the stable version is from 2016 : http://wiki.codeblocks.org/index.php/Main_Page

EDIT : The gcc.exe file is there, but the program can't find the compiler for some weird reason.
« Last Edit: March 29, 2020, 05:38:55 pm by Eboy »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Environment error
« Reply #3 on: March 29, 2020, 05:38:47 pm »
Ok, I downloaded the setup, installed it an ran C::B. The compiler that is included and was installed also was detected properly. So I cannot reproduce.

What are the exact steps you did? Did you unselect something during installation? How big is the executable? Is there a "MinGW" sub- folder in the folder where you installed C::B to? What is that folder?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Eboy

  • Single posting newcomer
  • *
  • Posts: 2
Re: Environment error
« Reply #4 on: March 29, 2020, 05:41:18 pm »
I think the issue is that it could be detecting a 32bit system on a 64bit system, not entirely sure, and yes, I will make a video if you would prefer on the install process. I gave you a link to the install I chose, which does encompass the mingw/gcc suite. I did select the full install so it should have encompassed the compiler itself.

EDIT : Sent via Private Message the link to the video mortymacfly.

EDIT 2 : https://drive.google.com/file/d/1PxLsIwLDUzidctBlrfRYpqiZMSbzdwoM/view?usp=sharing

EDIT 3 : found out how to solve this.
« Last Edit: March 29, 2020, 06:20:51 pm by Eboy »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Environment error
« Reply #5 on: March 30, 2020, 01:20:41 pm »
https://drive.google.com/file/d/1PxLsIwLDUzidctBlrfRYpqiZMSbzdwoM/view?usp=sharing
Sorry for that, I didn't expect a PM on this and missed it.

So, from what I see in the video: C::B and the compiler are installed just fine. You need to do just one final step.

- Go to the compiler settings (Settings > Compiler)
- Switch to the tab "Toolchain executables"
- Try "Auto-detect"
- If that fails, select the path manually and browse/select your MinGW folder (sub-folder of C::B in your case, NOT the MinGW\bin folder!).
- Also, you may have to change the executable names under "toolchain executables" to gcc.exe, g++.exe (remove the "mingw32" prefix)

That should do it.

Next time, please continue to post in the forums. PM's are easily getting missed/ignored.

Edit: Added last bullet.
« Last Edit: April 01, 2020, 09:45:22 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

bonipk

  • Guest
Re: Environment error
« Reply #6 on: March 30, 2020, 11:15:01 pm »
I am having same problem and nothing is working. Could it be the initial window defender message?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Environment error
« Reply #7 on: April 01, 2020, 08:53:17 am »
I am having same problem and nothing is working. Could it be the initial window defender message?
What Windows Defender message?
And what means "nothing is working"?

...and I missed one point:
- You may have to change the executable names under "tlolchain executables" to gcc.exe, g++.exe (remove the "mingw32" prefix).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline takashi_85

  • Single posting newcomer
  • *
  • Posts: 3
Re: Environment error
« Reply #8 on: September 15, 2021, 12:13:26 am »
C:\MinGW/bin/gcc.exe should be C:\MinGW\bin\gcc.exe

Slashes are not valid in path strings in windows environment!! , this may have leaked from linux or Mac code !!.
As a temporary work around you can compile your code manually with command line  :-\ .
I confirm that i have the same problem with "codeblocks-20.03mingw-32bit-setup.exe" package under windows 7 32-bit.
Although it's a simple misconfiguration-or bug- but it's very nasty, as it prevents users from compiling "default template C++ code" after a fresh install !.
« Last Edit: September 15, 2021, 12:20:24 am by takashi_85 »

Offline takashi_85

  • Single posting newcomer
  • *
  • Posts: 3
Re: Environment error
« Reply #9 on: September 15, 2021, 01:14:05 am »
I came down to this , i think this FixPathSeparators was called when it shouldn't be called!!. May be after compiler-->forceFwdSlashes was set to true for some reason.
Maybe C/C++ developers here can help!.
Code
void CompilerCommandGenerator::FixPathSeparators(Compiler* compiler, wxString& inAndOut)
{
    // replace path separators with forward slashes if needed by this compiler
    if (!compiler || !compiler->GetSwitches().forceFwdSlashes)
        return;

    size_t i = 0;
    while (i < inAndOut.Length())
    {
        if (inAndOut.GetChar(i) == _T('\\') &&
            (i == inAndOut.Length() - 1 || inAndOut.GetChar(i + 1) != _T(' ')))
        {
            inAndOut.SetChar(i, _T('/'));
        }
        ++i;
    }
}
« Last Edit: September 15, 2021, 01:56:40 am by takashi_85 »