troelskn
September 21st, 2005, 07:41 AM
Hello
I'm trying to compile a program written in c++ .NET. I have previously managed to compile it as a console application, but I want it to run as a windowed app. I am now getting odd errors, which I don't understand.
I compile with :
cl /clr MyApp.cpp /link /subsystem:windows
And the error I recieve is :
C:\src\MyApp>cl /clr MyApp.cpp /link /subsystem:windows
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
MyApp.cpp
MyApp.cpp(163) : error C2039: 'GetEnvironmentVariableA' : is not a member of 'System::Environment'
MyApp.cpp(18) : see declaration of 'System::Environment'
MyApp.cpp(163) : error C2660: 'GetEnvironmentVariableA' : function does not take 1 arguments
MyApp.cpp(178) : error C2039: 'GetEnvironmentVariableA' : is not a member of 'System::Environment'
MyApp.cpp(18) : see declaration of 'System::Environment'
MyApp.cpp(178) : error C2660: 'GetEnvironmentVariableA' : function does not take 1 arguments
The offending lines are theese:
(#18)
#using <mscorlib.dll>
(#163)
String* sDirSpybot = String::Concat(Environment::GetEnvironmentVariable(S"ALLUSERSPROFILE"), "\\Application Data\\Spybot - Search & Destroy\\Logs");
(#178)
sComputerName = Environment::GetEnvironmentVariable(S"COMPUTERNAME");
It appears to me as if the problem stems from linking with mscorlib.dll, but I got no idea how to fix it ?
I'm trying to compile a program written in c++ .NET. I have previously managed to compile it as a console application, but I want it to run as a windowed app. I am now getting odd errors, which I don't understand.
I compile with :
cl /clr MyApp.cpp /link /subsystem:windows
And the error I recieve is :
C:\src\MyApp>cl /clr MyApp.cpp /link /subsystem:windows
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
MyApp.cpp
MyApp.cpp(163) : error C2039: 'GetEnvironmentVariableA' : is not a member of 'System::Environment'
MyApp.cpp(18) : see declaration of 'System::Environment'
MyApp.cpp(163) : error C2660: 'GetEnvironmentVariableA' : function does not take 1 arguments
MyApp.cpp(178) : error C2039: 'GetEnvironmentVariableA' : is not a member of 'System::Environment'
MyApp.cpp(18) : see declaration of 'System::Environment'
MyApp.cpp(178) : error C2660: 'GetEnvironmentVariableA' : function does not take 1 arguments
The offending lines are theese:
(#18)
#using <mscorlib.dll>
(#163)
String* sDirSpybot = String::Concat(Environment::GetEnvironmentVariable(S"ALLUSERSPROFILE"), "\\Application Data\\Spybot - Search & Destroy\\Logs");
(#178)
sComputerName = Environment::GetEnvironmentVariable(S"COMPUTERNAME");
It appears to me as if the problem stems from linking with mscorlib.dll, but I got no idea how to fix it ?