locked
A namespace with this name does not exist RRS feed

  • Question

  • Hi,
    How to resolve this

    1>c:\App10\App10.cpp(10): error C2871: 'System' : a namespace with this name does not exist

    due to the line below?
    #include "stdafx.h"
    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    #include <process.h>
    
    using namespace System;
    ...



    Many Thanks & Best Regards, Hua Min

    Tuesday, June 25, 2013 9:44 AM

Answers

  • You must compile with the Common Language Runtime Support (/clr).
    Rigth click on your solution, in configuration properties, select general, and select clr for Common Language Runtime Support.
    • Proposed as answer by SimonRev Tuesday, June 25, 2013 3:46 PM
    • Marked as answer by Elegentin Xie Tuesday, July 9, 2013 7:39 AM
    Tuesday, June 25, 2013 9:49 AM

All replies

  • You must compile with the Common Language Runtime Support (/clr).
    Rigth click on your solution, in configuration properties, select general, and select clr for Common Language Runtime Support.
    • Proposed as answer by SimonRev Tuesday, June 25, 2013 3:46 PM
    • Marked as answer by Elegentin Xie Tuesday, July 9, 2013 7:39 AM
    Tuesday, June 25, 2013 9:49 AM
  • Where is the option? I am currently using VS 2010.


    Many Thanks & Best Regards, Hua Min

    Tuesday, June 25, 2013 10:07 AM
  • namespace System { } using namespace System;


    Christopher Yeleighton

    Tuesday, June 25, 2013 10:48 AM
  • Just right click on a file in Solution Explorer and hit Properties. The option is "Compile with Common Language Runtime Support", under C/C++ -> General.

    Tuesday, June 25, 2013 11:00 AM
  • A more important question, is why are you using the namespace System? What feature of the .NET framework are you using?
    Tuesday, June 25, 2013 3:19 PM