Author Topic: command line ways of getting Ming gcc running?  (Read 3067 times)

Offline yarly

  • Single posting newcomer
  • *
  • Posts: 8
command line ways of getting Ming gcc running?
« on: July 15, 2015, 09:43:43 am »
What are the command line ways of pointing gcc to the helper executables so that you don't get the error

gcc: error: CreateProcess: No such file or directory

The error is mentioned here

http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista

And it shows a GUI way around it.  To enable Ming's gcc to find its helper executables.

But what are  the command line ways around it?

What is codeblocks doing in the background with the command line Ming gcc to make it work?


I have found it works with PATH=.  or PATH= 

e.g.

Code
C:\MinGW\bin>set path=

C:\MinGW\bin>gcc file6.c

C:\MinGW\bin>

Whereas it fails doing this

Code
C:\MinGW\bin>set path=c:\Perl64\site\bin

C:\MinGW\bin>gcc a.c
gcc: error: CreateProcess: No such file or directory

C:\MinGW\bin>

Though this works

Code
C:\MinGW\bin>set path=c:\Perl64\site\bin

C:\MinGW\bin>.\gcc a.c

C:\MinGW\bin>

In both cases it is running C:\MinGW\bin\gcc.exe

So it seems that whether you do .\gcc or gcc dictates whether after gcc is run, where it looks for helper files. With the .\   windows find and executes the gcc in the current directory, but then gcc just looks in or within the current directory.  Without the .\  windows finds and executes the gcc in the current directory, but then gcc looks in the path.

(And it's not like in bash/bourne where if the current directory is not in the path then it won't look in the current directory. It is running the gcc in the current directory)

This works 
Code
C:\MinGW\bin>set path=.;c:\Perl64\site\bin 
       (i.e. adding the current directory to the path)   
And this works
Code
C:\MinGW\bin>set path=c:\MinGW\bin.;c:\Perl64\site\bin
  (i.e. adding the current directory to the path)
i.e. with those two paths,  gcc and .\gcc work

What is it that codeblocks does at the command line, as set in the GUI, to get Ming gcc to work?

(I've added code tags to make formatting clearer, as suggested by BlueHazzard)
 
« Last Edit: July 15, 2015, 08:38:39 pm by yarly »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: command line ways of getting Ming gcc running?
« Reply #1 on: July 15, 2015, 11:47:42 am »
what exactly want you to do? (apart from your $PATH problems)
and was has this to do with c::b?
i can't distinguish your commands and comments, so i would suggest you wrap your command line commands and the results into code tags (# symbol in the forum editor)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: command line ways of getting Ming gcc running?
« Reply #2 on: July 15, 2015, 08:32:20 pm »
Possible answer to your NON code::blocks question.

I have only seen that or a related error when building wxWidgets using the make command "mingw32-make -f makefile.gcc"

I found that the cause was sh.exe being in the path.

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 yarly

  • Single posting newcomer
  • *
  • Posts: 8
Re: command line ways of getting Ming gcc running?
« Reply #3 on: July 15, 2015, 08:40:53 pm »
It's partly a code::blocks question because i'm asking what code blocks does with Ming's GCC to tell it where to find the helper executables

I see what it does in the GUI

http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista

But i'm guessing the GUI works by interfacing with the command line.

So i'm asking how code::blocks solves that gcc issue , at the command line level

ADDED

I see Code::Blocks   "Global compiler settings" window, uses mingw32-gcc.exe
 
And that doesn't give the error. So I guess that solves it

Code
C:\MinGW\bin>set path=c:\Perl64\site\bin

C:\MinGW\bin>mingw32-gcc file6.c

C:\MinGW\bin>gcc file6.c
gcc: error: CreateProcess: No such file or directory

C:\MinGW\bin>.\gcc file6.c

C:\MinGW\bin>
« Last Edit: July 15, 2015, 09:02:49 pm by yarly »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: command line ways of getting Ming gcc running?
« Reply #4 on: July 15, 2015, 08:47:14 pm »
[I believe] CB adds the path to the MinGW bin folder before all the other paths.

As if it did this
Code
SET PATH=C:\MinGW\bin;%PATH% 

Tim S.
 
« Last Edit: July 16, 2015, 03:23:04 am by stahta01 »
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