简体   繁体   中英

error in visual c++ code about namespace

I am just a beginner in C++. I have errors with namespaces in Visual C++. Here is the code which include files I have to add for this foundation. The error says the name must be a namespace name. I add whole code is source folder. There is not single file in header. Wow many files do I have to add?

using namespace System;
int main() 
{
    if (Environment::HasShutdownStarted)
        Console::WriteLine("Shutting down.");
    else
        Console::WriteLine("Not shutting down.");
    return 0;
}

You should add this:

#using <mscorlib.dll>

If you want to use System namespace. Hope this helps.. :)

Try adding this:

#using <mscorlib.dll>

It is used to let the compiler know you are working with the system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM