Yanick Rochon
Yanick Rochon

Reputation: 53576

Syntax error : identifier 'String'

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?

Upvotes: 1

Views: 3124

Answers (1)

Armen Tsirunyan
Armen Tsirunyan

Reputation: 133054

use System::String and System::IntPtr or write using namespace System;

Upvotes: 5

Related Questions