【问题标题】:System.Drawing not working in c++System.Drawing 在 C++ 中不起作用
【发布时间】:2013-12-09 17:15:43
【问题描述】:

我正在尝试在C++ 中使用命名空间System.Drawing。尽管我已经引用了必需的dll 文件,即System.Drawing.dll,但我仍然不能使用System.Drawing 命名空间。

#using <System.Drawing.dll>


using namespace System;
using namespace System.Drawing;

int main()
{




    getch();

}

我收到以下错误。

Error 1 error C2143: syntax error : missing ';' before '.' c:\Users\Labeeb\documents\visual studio 2013\Projects\cursor movement\cursor movement\Source.cpp 7 1 cursor movement

【问题讨论】:

  • C++ 不使用点来解析名称。
  • 您在制作 CLI 项目吗?因为System 不是 C++
  • @doctorlove 是的,它的 CLI 项目
  • @chris 有什么选择?实际上我在 C# 中使用了点
  • @Labeeb 我可以建议你阅读我的回答:)

标签: .net dll namespaces c++-cli


【解决方案1】:

使用:: 代替. 进行名称范围解析:

using namespace System::Drawing;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-19
    • 2011-04-08
    • 2011-06-03
    • 1970-01-01
    • 1970-01-01
    • 2021-08-04
    • 2015-09-08
    • 2014-04-29
    相关资源
    最近更新 更多