what is going on here with the PATH?
Posted: 13 Jul 2015 08:26
I do not understand this
I have two gcc.exe files they are both different.
I guess i'll try to explain what I might expect.. though what I expect is all wrong and then perhaps those here can enlighten me as to why this is happening
Looking at the above, I do not understand why there should be a difference between gcc and .\gcc
I thought the current directory is in the path by default.. for example if I do set path=, and then do gcc<ENTER> then ir runs gcc (and with no error from gcc). The fact that it runs gcc at all, when I have set path=, tells me that dot is in the path by default.. So then why should I get a difference from gcc between doing .\gcc and gcc as I see above?!
I guess that where command is telling me that the MinGW one, the one in the current directory, will execute first.
And the Ming gcc will execute first even when it's not in the path, as long as I am in c:\MinGW
So what is going on above?!
And what is going on above there? Why does gcc suddenly give no error, when the path is blank?
I thought maybe DLL files use the PATH.. and maybe there is a DLL in the perl directory that is getting hit on..
But that's not the case.. in that every dll in the path, is in c:\MinGW
So I am stumped
I have two gcc.exe files they are both different.
I guess i'll try to explain what I might expect.. though what I expect is all wrong and then perhaps those here can enlighten me as to why this is happening
Code: Select all
C:\MinGW\bin>set path=.;c:\windows\system32;C:\Perl64\site\bin
C:\MinGW\bin>gcc file6.c
C:\MinGW\bin>.\gcc file6.c
C:\MinGW\bin>set path=c:\windows\system32;C:\Perl64\site\bin
C:\MinGW\bin>gcc file6.c
gcc: error: CreateProcess: No such file or directory
C:\MinGW\bin>.\gcc file6.c
C:\MinGW\bin>
Looking at the above, I do not understand why there should be a difference between gcc and .\gcc
I thought the current directory is in the path by default.. for example if I do set path=, and then do gcc<ENTER> then ir runs gcc (and with no error from gcc). The fact that it runs gcc at all, when I have set path=, tells me that dot is in the path by default.. So then why should I get a difference from gcc between doing .\gcc and gcc as I see above?!
Code: Select all
C:\MinGW\bin>where gcc
C:\MinGW\bin\gcc.exe
C:\Perl64\site\bin\gcc.exe
I guess that where command is telling me that the MinGW one, the one in the current directory, will execute first.
Code: Select all
C:\MinGW\bin>path
PATH=c:\windows\system32;C:\Perl64\site\bin
C:\MinGW\bin>set path=.;c:\windows\system32;C:\Perl64\site\bin
C:\MinGW\bin>where gcc
C:\MinGW\bin\gcc.exe
C:\Perl64\site\bin\gcc.exe
C:\MinGW\bin>
And the Ming gcc will execute first even when it's not in the path, as long as I am in c:\MinGW
Code: Select all
C:\MinGW\bin>set path=c:\windows\system32;C:\Perl64\site\bin
C:\MinGW\bin>C:\Perl64\site\bin\gcc file6.c
C:\MinGW\bin>.\gcc file6.c
C:\MinGW\bin>gcc file6.c
gcc: error: CreateProcess: No such file or directory
C:\MinGW\bin>
So what is going on above?!
Code: Select all
C:\MinGW\bin>set path=
C:\MinGW\bin>gcc file6.c
C:\MinGW\bin>
And what is going on above there? Why does gcc suddenly give no error, when the path is blank?
I thought maybe DLL files use the PATH.. and maybe there is a DLL in the perl directory that is getting hit on..
But that's not the case.. in that every dll in the path, is in c:\MinGW
Code: Select all
C:\MinGW\bin>for %f in (*.dll) do @where %f
C:\MinGW\bin\libcharset-1.dll
C:\MinGW\bin\libgcc_s_dw2-1.dll
C:\MinGW\bin\libgmp-10.dll
C:\MinGW\bin\libgmpxx-4.dll
C:\MinGW\bin\libgomp-1.dll
C:\MinGW\bin\libiconv-2.dll
C:\MinGW\bin\libintl-8.dll
C:\MinGW\bin\libmpc-3.dll
C:\MinGW\bin\libmpfr-4.dll
C:\MinGW\bin\libquadmath-0.dll
C:\MinGW\bin\libssp-0.dll
C:\MinGW\bin\mingwm10.dll
C:\MinGW\bin\pthreadGC2.dll
C:\MinGW\bin\pthreadGCE2.dll
C:\MinGW\bin\zlib1.dll
C:\MinGW\bin>
So I am stumped