Saturday, 15 August 2015

C++: Setenv(). Undefined identifier in Visual Studio -


I think my code looks correct, according to all the documents I can find online my IDE MS Visual Studio Express 4 Windows Desktop 2012, and this is throwing the compiler error:

Error 1 error C3861: 'setenv': Identifier not found e: \ user \ owner \ document \ Visual Studio 2012 \ Project \ Project 1 \ Project 1 \ Source 1 Cop 18 1 Project 1 .

Help me!

  #include & lt; Windows h & gt; # Include & lt; Sstream & gt; # Include & lt; Ostream & gt; # Include & lt; Cstdlib & gt; # Include & lt; Iostream & gt; # Include & lt; Stdlib.h & gt; using namespace std; Int howManyInClass = 0; Int main () {long checkline = sizeof (getenv ("classize")) / sizeof (* getenv ("classize")); If (Czech langatry == 0) {cout & lt; & Lt; "Please enter the amount of students in your class"; CIN & gt; & Gt; HowManyInClass; Cin.ignore (); Settw ("class size", howamineclass, 1);}};    

You can either use the string classSize = 7 ; ostringstream class size; Class size & lt; & Lt; "Class Size =" & lt; & Lt; HowManyInClass; _putenv (. ClassSize.str () c_str ());

... or (preferably) security has been increased which takes the key and value as a separate (Cons Chart *) parameter;

  ostringstream classSize; Class size & lt; & Lt; HowManyInClass; _putenv_s ("class size", classSize.str () .c_str ());    

No comments:

Post a Comment