大神指点~'putenv' was not declared in this scope,该怎么处理
大神指点~'putenv' was not declared in this scope
我在dev-C++中编译程序
他报错'putenv' was not declared in this scope
可是我有#include <stdlib.h>啊
这真心不懂了
求大神指点~
------解决方案--------------------
试试 _putenv 呢.
------解决方案--------------------
试试这个可行的例子:
------解决方案--------------------
那奇怪了,你试试先用C编译,就是说源代码是.c的。
------解决方案--------------------
_putenv
Creates new environment variables; modifies or removes existing ones.
int _putenv( const char *envstring );
Routine Required Header Compatibility
_putenv <stdlib.h> Win 95, Win NT
------解决方案--------------------
你不要建C++的工程,建C的工程就好。
我在dev-C++中编译程序
他报错'putenv' was not declared in this scope
可是我有#include <stdlib.h>啊
这真心不懂了
求大神指点~
------解决方案--------------------
试试 _putenv 呢.
------解决方案--------------------
试试这个可行的例子:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern char **environ;
int main(void)
{
char *path, *ptr;
int i = 0;
/* get the current path environment */
ptr = getenv("PATH");
/* set up new path */
path = malloc(strlen(ptr)+15);
strcpy(path,"PATH=");
strcat(path,ptr);
strcat(path,";c://temp");
/* replace the current path and display current environment */
putenv(path);
while (environ[i])
printf("%s/n",environ[i++]);
return 0;
}
------解决方案--------------------
那奇怪了,你试试先用C编译,就是说源代码是.c的。
------解决方案--------------------
_putenv
Creates new environment variables; modifies or removes existing ones.
int _putenv( const char *envstring );
Routine Required Header Compatibility
_putenv <stdlib.h> Win 95, Win NT
------解决方案--------------------
你不要建C++的工程,建C的工程就好。
那奇怪了,你试试先用C编译,就是说源代码是.c的。
怎么操作呀![]()