Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error 2514 again...

Status
Not open for further replies.

Nosferatu

Programmer
Jun 9, 2000
412
RO
Ok, the problem seems to be my approach to the problem.

I have several classes that are crossreferencing each other via pointers.

What i do:

1. Include "common.h" header.
2. Declare a class in a header file and use the pointers to other classes declared in "common.h".
3. Add in "common.h" header the typedef for a pointer to the new class :
Code:
 typedef class myClass * PmyClass;

What is happening is that when i try to dynamically create a new class, i get the 2514 error (class has no cosntructors). It wasn't related to NamedNodeMap as i previously thought. So, each time i try to use the following:
Code:
PmyClass pc = new myClass(something);
i get the error...

I hope i was clearer this time.
Thank you all!
Nosferatu
We are what we eat...
There's no such thing as free meal...
 
Just a thought... I am not sure if this will work but...

try typing

class myClass;

at the top of the file you're getting the error in

Matt
 
Ok everybody... I found the problem...
The problem was that i wasn't saying
" #include "the_other_class_definition_file.h" in the CPP file where i was using it, supposing the automatic use of the precompiled headers in Project Options will do the trick.
But, since i have not specified the "through header" field there, i suppose the precompiled headers were simply not built or used (even if the pch file is in my Debug sub-directory). I don't get it...

Anyway, the problem was solved by including the header where the class that was dinamically allocated was defined in the file where i was trying to create the object and everithing started to work...

The error 2514 was generated i think because of the typedef in the "common.h" header i mentioned earlier.
Anyway, this is a really stupid error to get, the proper error message should have been something like "usage of unknown struct/class/union ****classname****" or something like that...

Thanks anyway Matt, i've tried that too... actually, i don't know what i haven't tried so far beside the "include" thing... Nosferatu
We are what we eat...
There's no such thing as free meal...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top