Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Please help with weird compile error

This topic is 5349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For some reason code that has been tested and worked fine before now creates a compile time error I don''t understand. It says could not find a match for Material_MD3::MaterialMD3(const MaterialMD3) Error code E2285 in C++ builder. The error happens in a file called memory.stl. I am using the template in vector.h and when I push_back an item this error is created. Another weird thing is that Material_MD3 is a structure, not a class and this error obviously is looking for a constructor. Any ideas on what might be going wrong would be greatly appreciated.

Share this post

Link to post
Share on other sites
Perhaps the declaration should be
Material_MD3::MaterialMD3(const MaterialMD3 & )      
instead of
Material_MD3::MaterialMD3(const MaterialMD3)     

Or perhaps it needs a copy constructor and none (including the default) is available for some reason.


[edited by - JohnBolton on March 27, 2004 5:05:30 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
sturctures also have contructors.
The only difference between a class and a struct is that class default to private and structs public

Share this post

Link to post
Share on other sites
There is a subtle difference between Material_MD3 and MaterialMD3

Yup, that's just plain evil...

[edited by - amag on March 26, 2004 8:24:54 AM]

Share this post

Link to post
Share on other sites
Sorry guys, I forgot a couple underscores when i type my post.
It was supposed to say this

Could not find a match for Material_MD3::Material_MD3(const Material_MD3)

Share this post

Link to post
Share on other sites
Uhm, maybe if you posted some of the offending code, it would be easier to help you.
Anyway, here are some thoughts:

Material_MD3::Material_MD3(const Material_MD3)
// should probably be

Material_MD3::Material_MD3(const Material_MD3 &)
// for a copy-ctor

If you have defined a ctor for Material_MD3, then it might be a good thing to have both a copy ctor and a default ctor (one that takes no args) if used with STL.

Note that if you define one ctor for your class (no matter what it looks like), the compiler won''t generate any of the ''free'' ones (copy ctor and default ctor).

Share this post

Link to post
Share on other sites
I know why it''s happening now I just don''t know what to do about it. One of the item in Material_MD3 is a class that has a copy constructor. I commented out this copy constructor and everything worked fine so that is definitely the source of the problem.

Here is Material_MD3

typedef struct {
char strName[255];
char strFile[255];
unsigned char color[3];
float fColor[3];
int texureId;
float uTile;
float vTile;
float uOffset;
float vOffset;
Textures Tex; // this is the class i mentioned

The Material_MD3 list is declared like this
vector pMaterials;

The area of code that causes error is this

Material_MD3 Mat;

if(pSkins[Counter][strlen(pSkins[Counter])-3] == ''p'')
if(pSkins[Counter][strlen(pSkins[Counter])-2] == ''c'' && pSkins[Counter][strlen(pSkins[Counter])-1] == ''x'')
Model.pMaterials.push_back(Mat); // here causes problem

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!