Installation: setting environment variables

View: New views
7 Messages — Rating Filter:   Alert me  

Parent Message unknown Installation: setting environment variables

by Joel C. Salomon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've just installed MinGW (5.1.3) on a new computer, and am not
remembering how to set the environment variables.

Mingw is installed to c:\hacking\mingw, so I've set my %path% to
...;c:\hacking\mingw\bin;....  Programs are found -- gcc --version
correctly tells me that 3.4.5 is installed -- but it can't complile,
telling me that cc1 isn't found.  So I added
C:\Hacking\MinGW\libexec\gcc\mingw32\3.4.5 to the %path% (which I
don't remeber doing before!) and now gcc complains "randint.c:1:19: no
include path in which to search for stdio.h".

What environment variables do I need to set to make things work?

--Joel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Greg Chicares-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2007-09-30 18:30Z, Joel C. Salomon wrote:

> I've just installed MinGW (5.1.3) on a new computer, and am not
> remembering how to set the environment variables.
>
> Mingw is installed to c:\hacking\mingw, so I've set my %path% to
> ...;c:\hacking\mingw\bin;....  Programs are found -- gcc --version
> correctly tells me that 3.4.5 is installed -- but it can't complile,
> telling me that cc1 isn't found.  So I added
> C:\Hacking\MinGW\libexec\gcc\mingw32\3.4.5 to the %path% (which I
> don't remeber doing before!) and now gcc complains "randint.c:1:19: no
> include path in which to search for stdio.h".
>
> What environment variables do I need to set to make things work?

It should work without setting any environment variable.
You can even dispense with PATH:

C:\tmp>PATH ''

C:\tmp>PATH
PATH=''

C:\tmp>type hello.c
#include <stdio.h>

void hello()
{
   printf("hello, world!\n");
}

int main()
{
   hello();
   return 0;
}

C:\tmp>C:\MinGW-20060119\bin\gcc hello.c

C:\tmp>a
hello, world!

C:\tmp>C:\MinGW-20060119\bin\gcc -dumpversion
3.4.5


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Suresh Govindachar` :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


  Joel asked
  >
  > I've just installed MinGW (5.1.3) on a new computer, and am not
  > remembering how to set the environment variables.
  >
  > Mingw is installed to c:\hacking\mingw, so I've set my %path% to
  > ...;c:\hacking\mingw\bin;....  Programs are found -- gcc
  > --version correctly tells me that 3.4.5 is installed -- but it
  > can't complile, telling me that cc1 isn't found.  So I added
  > C:\Hacking\MinGW\libexec\gcc\mingw32\3.4.5 to the %path% (which
  > I don't remeber doing before!) and now gcc complains
  > "randint.c:1:19: no include path in which to search for
  > stdio.h".
  >
  > What environment variables do I need to set to make things work?

  It depends on the command being used for compiling.

  For example, without setting any path or environment variable,
  one can build some projects using a command such as the
  following (the stuff below is all in one line):

   x:\hacking\mingw\bin\mingw32-make.exe  -f the_make_file
                    THE_DEFIN=its_val
                    CC="x:/hacking/MinGW/bin/gcc  
                       -Ix:/hacking/MinGW/include
                       -Lx:/hacking/MinGW/lib"

  Because of this message that you are seeing
 
  > "randint.c:1:19: no include path in which to search for
  > stdio.h".

  I suspect you need to start by specifying the right include
  path via. -I<path> (then you might start seeing linking errors
  about not finding libraries -- try resolving that with -L<path>
  and/or -l<value>).

  --Suresh


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Danny Smith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



> -----Original Message-----
> From: mingw-users-bounces@...
> [mailto:mingw-users-bounces@...] On Behalf
> Of Joel C. Salomon
> Sent: Monday, 1 October 2007 7:30 a.m.
> To: MinGW Users List
> Subject: [Mingw-users] Installation: setting environment variables
>
>
> I've just installed MinGW (5.1.3) on a new computer, and am not
> remembering how to set the environment variables.
>
> Mingw is installed to c:\hacking\mingw, so I've set my %path% to
> ...;c:\hacking\mingw\bin;....  Programs are found -- gcc --version
> correctly tells me that 3.4.5 is installed -- but it can't complile,
> telling me that cc1 isn't found.  So I added
> C:\Hacking\MinGW\libexec\gcc\mingw32\3.4.5 to the %path% (which I
> don't remeber doing before!) and now gcc complains "randint.c:1:19: no
> include path in which to search for stdio.h".
>
> What environment variables do I need to set to make things work?
>

Environment variables are not the issue.  The issue is probably that
your new computer has Vista installed.
Search the archives for discussion of the _access() function on Vista.
The solution is to download patched versions of the gcc.exe, g++.exe
drivers that work as expected on Vista.
Danny


> --Joel
>
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> MinGW-users mailing list
> MinGW-users@...
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Joel C. Salomon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 9/30/07, Danny Smith <dannysmith@...> wrote:
> > What environment variables do I need to set to make things work?
>
> Environment variables are not the issue.  The issue is probably that
> your new computer has Vista installed.
> Search the archives for discussion of the _access() function on Vista.
> The solution is to download patched versions of the gcc.exe, g++.exe
> drivers that work as expected on Vista.

I hadn't thought about it as a problem before, but yes, this is a Vista machine.

I found <http://www.nabble.com/environment-hosed-during-upgrade-t3305745.html>;
where should I put the xgcc-3.4.5.exe I've downloaded, and should I
rename it to something else?  Is this in fact the patched gcc you were
referring to?

--Joel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Danny Smith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I hadn't thought about it as a problem before, but yes, this
> is a Vista machine.
>
> I found
> <http://www.nabble.com/environment-hosed-during-upgrade-t33057
45.html>;
where should I put the xgcc-3.4.5.exe I've downloaded, and should I
rename it to something else?  Is this in fact the patched gcc you were
referring to?

Yes.  Here is a more convenient set of patched binaries, provided by
Brian Dessent, whom I quote:


----------------------------------
If it helps anyone else, I took the three patched drivers that Danny
posted (gcc, g++, collect2) and copied them to their various aliases
(e.g. c++, mingw-g++, etc) and put them in the appropriate directory
structure, and made it a tarball:

http://dessent.net/tmp/gcc-vista-3.4.5-20060117-1.tar.gz

$ tar ztvf gcc-vista-3.4.5-20060117-1.tar.gz
-rwxr-xr-x brian/None    86016 2007-05-18 18:41 bin/c++.exe
-rwxr-xr-x brian/None    86016 2007-05-18 18:41 bin/g++.exe
-rwxr-xr-x brian/None    83456 2007-05-18 18:40 bin/gcc.exe
-rwxr-xr-x brian/None    86016 2007-05-18 18:41 bin/mingw32-c++.exe
-rwxr-xr-x brian/None    86016 2007-05-18 18:41 bin/mingw32-g++.exe
-rwxr-xr-x brian/None    83456 2007-05-18 18:40 bin/mingw32-gcc-3.4.5
-rwxr-xr-x brian/None    83456 2007-05-18 18:40 bin/mingw32-gcc.exe
-rwx------ brian/None    85504 2007-05-18 18:41
libexec/gcc/mingw32/3.4.5/collect2.exe

If you unpack this in your MinGW root folder (e.g. /mingw) just like all
the other gcc-foo tarballs it should install the files in all the right
places.  I tested this on a Vista copy running VMware and it worked fine
for compiling and linking C and C++.
----------------------------------


--Joel

------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: Installation: setting environment variables

by Joel C. Salomon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 9/30/07, Danny Smith <dannysmith@...> wrote:
> Here is a more convenient set of patched binaries, provided by Brian Dessent

Thanks Danny & Brian; it worked!

--Joel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users