1

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?

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

thanks. We have so little support from that teacher... and most of the class never coded with VC++ (not to mention creating DLL mixing C++ and C#) before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.