String

R

Rado

Hello.
I have one problem.
I make class:
And in Public I declare!"
String* name[10];

But Compilator write mi error. d:\My projects\Visual
C++\Zadanie_OP\studentcollection.h(10): error C2146: syntax error : missing
';' before identifier 'name'

Know anybody where can be problem?
Thanks
 
G

Guest

It doesn't recognize the String class. There a couple common cause

First, the library may not be included in the file. You include the libarary with the following line near the beginning of the file

#using <mscorlib.dll

Second, you may not be using the correct namespace. The first solution is to tell the compilier that you want to use that namespce. I use this in my cpp files to make the code more readable. You can do this with the following line after the #using statement

using namespace System

An alternative solution to the second cause is to explictly type the namespace when you use the type. I do this in my header files so I can reduce the amount of using namespace statements the sneak into my cpp files. You do this by defining the variable as follows

System::String* name[10];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top