语法错误:标识符“字符串”
我们收到了这段作业代码,在花了很多时间修复其中的问题后,我最终遇到了一个语法错误:标识符'String'
。我在网络上看到的每个地方,人们都在使用 std::string
,但这不是代码所指的内容,因为该函数是使用 String
从 C# 项目调用的> 对象。
这是声明:
int findWindow(String ^CaptionText,IntPtr ^%phWnd,
int %left,int %top,int %right,int %bottom);
我不知道如何解决这个问题。还有其他错误,例如
error C2062: type 'int' unexpected
...
error C2065: 'IntPtr' : undeclared identifier
error C2065: 'String' : undeclared identifier
...
等。
任何帮助表示赞赏。
我应该提到这些错误与作业无关吗?
We received this piece of code for an assignment, and after spending a lot of time fixing the problems within, I ended up with a syntax error : identifier 'String'
. Everywhere I look on the web, people are using std::string
, but this is not what the code is referring to since the function is called from a C# project using a String
object.
Here is the declaration :
int findWindow(String ^CaptionText,IntPtr ^%phWnd,
int %left,int %top,int %right,int %bottom);
And I have no idea how to fix that one. There are other errors such as
error C2062: type 'int' unexpected
...
error C2065: 'IntPtr' : undeclared identifier
error C2065: 'String' : undeclared identifier
...
etc.
Any help appreciated.
Should I mention that those errors have nothing to do with the assignment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
System::String
和System::IntPtr
或编写using namespace System;
use
System::String
andSystem::IntPtr
or writeusing namespace System;