尝试在 xaml 中使用 String 类型时出现以下错误:
XLS0419 未定义的 CLR 命名空间。“clr-namespace”URI 引用了无法找到的命名空间“System”。
这是代码:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="options">
<!-- Matadata -->
<system:String x:Key="Theme.Name">Dark.Blue</system:String>
Run Code Online (Sandbox Code Playgroud)
'xmlns:system="clr-namespace:System; assembly=mscorlib"' 行是错误的位置。我只是从解决方案中另一个项目的另一个文件中复制了这段代码,并且该代码在那里工作正常。我不知道如何解决这个问题。
我尝试关闭 Visual Studio 并重新启动计算机。
在C#中我可以有两个嵌套类相互引用而没有问题:
public class CFGFile
{
class Setting
{
public Entry Ent;
}
class Entry
{
public Setting Setg;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在C++中尝试相同的操作会导致问题:
class CFGFile
{
class Setting;
class Entry
{
Setting Setg;
};
class Setting
{
Entry Ent;
]
};
Run Code Online (Sandbox Code Playgroud)
我明白了
"不允许不完整的类型"
在Setg变量定义和错误
"C2079:'CFGFile :: Entry :: Setg'使用未定义的类'CFGFile :: Setting'"
编译时
我正在使用Visual Studio 2017.
在C++的嵌套类中是否可以交叉引用?