Web lists-archives.com

[Mingw-users] setenv()

Hello, all

Is  the  setenv() function from stdlib.h supposed to
work in MinGW?  When I compile  the  following  pro-

#include <stdlib.h>
int main( int argc, char** argv )
{  setenv("test", "1", 1);
   return 0;

I get:

   cco6C8tG.o:test.c:(.text+0x26): undefined reference to `setenv'
   collect2.exe: error: ld returned 1 exit status

If  change  the  file extension to cpp, the error is

   test.cpp: In function 'int main(int, char**)':
   test.cpp:3:24: error: 'setenv' was not declared in this scope
    { setenv("test", "1", 1);

And where is stdlib.h located?  I couldn't  discover
it using:

   find / -name stdlib.h

()  ascii ribbon campaign - against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]

MinGW-users mailing list

This list observes the Etiquette found at 
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe