'System': a namespace with this name does not exist
-
I am NOT a C++ guy, so bear with me. I am working on a C#/WPF app that references two C++ projects. We just converted the solution from .Net Framework to .Net Core 6.0, and now the C++ projects won't compile while in the solution. If I open the C++ projects stand-alone, they compile file. Primarily I'm getting the compile time error
'System': a namespace with this name does not exist
I've been Googling and 99% of the answers [all say this](https://stackoverflow.com/questions/16732789/system-a-namespace-with-this-name-does-not-exist). I've tried the answers and still get the same errors. At this point I need help. I'm guessing it's some kind of configuration issue, but I really don't know. Thanks
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
I am NOT a C++ guy, so bear with me. I am working on a C#/WPF app that references two C++ projects. We just converted the solution from .Net Framework to .Net Core 6.0, and now the C++ projects won't compile while in the solution. If I open the C++ projects stand-alone, they compile file. Primarily I'm getting the compile time error
'System': a namespace with this name does not exist
I've been Googling and 99% of the answers [all say this](https://stackoverflow.com/questions/16732789/system-a-namespace-with-this-name-does-not-exist). I've tried the answers and still get the same errors. At this point I need help. I'm guessing it's some kind of configuration issue, but I really don't know. Thanks
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
An error message by itself does not tell us much. What is the context, and are you sure this would not fit better in Managed C++/CLI Discussion Boards[^] ?
Richard MacCutchan wrote:
What is the context
Not sure what you mean by "what is the context". Like I said, the project is in a solution with a C#/WPF project and the C++ project now doesn't compile.
Richard MacCutchan wrote:
and are you sure this would not fit better in Managed C++/CLI Discussion Boards
I have no clue. But I could move it there. Again, I have ZERO C++ experience, so I'm really in the dark with all this.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Richard MacCutchan wrote:
What is the context
Not sure what you mean by "what is the context". Like I said, the project is in a solution with a C#/WPF project and the C++ project now doesn't compile.
Richard MacCutchan wrote:
and are you sure this would not fit better in Managed C++/CLI Discussion Boards
I have no clue. But I could move it there. Again, I have ZERO C++ experience, so I'm really in the dark with all this.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Kevin Marois wrote:
Not sure what you mean by "what is the context"
All you have given us is an error message. We have no idea whether this is unmanaged or managed code, what the actual code that causes the error looks like &c.
OK, so here's the lines of code that are failing:
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;This error occurs in the using statements in every C++ file in the project. It's a .Net 6 project, so I'm assuming it Managed code. I'm not trying to be difficult, but I just don't know what I'm looking at so it's hard for me to know what to post here.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
OK, so here's the lines of code that are failing:
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;This error occurs in the using statements in every C++ file in the project. It's a .Net 6 project, so I'm assuming it Managed code. I'm not trying to be difficult, but I just don't know what I'm looking at so it's hard for me to know what to post here.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
OK, what you have is managed C++, AKA C++/CLI, which uses .NET. Those using statements are correct and it should build. However since you are converting from the Net Framework you probably need to look at Migrating C++/CLI projects to .NET Core and .NET 5+ - .NET Core | Microsoft Learn[^].
-
OK, what you have is managed C++, AKA C++/CLI, which uses .NET. Those using statements are correct and it should build. However since you are converting from the Net Framework you probably need to look at Migrating C++/CLI projects to .NET Core and .NET 5+ - .NET Core | Microsoft Learn[^].
OK thanks. I'll take a look
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.