Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have tried to include a library with a Plane class. The plane class has three constructors. The following is copied from the header file...
C++
ManipExport Plane(Point3& normal, Point3& point);
ManipExport Plane(Point3& p1, Point3& p2, Point3& p3);
ManipExport Plane(): mNormal(0,0,1), mPoint(0,0,0), mD(0.0f) {}


In my code, I can compile the following...
C++
Point3 p0, p1, p2;
p0 = mn.v[mn.f[this_face].vtx[0]].p;
p1 = mn.v[mn.f[this_face].vtx[1]].p;
p2 = mn.v[mn.f[this_face].vtx[2]].p;

Plane pln(p0, p1);


but when I try to use the the second constructor as follows I get an error
C++
Plane pln(p0, p1, p2);

I don't understand why I can compile with one constructor but not the other. I'm not even sure what I should be looking out for with this error so some hints as to what to research would be welcome...

The error is as follows.....
txt
 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl Plane::Plane(class Point3 &,class Point3 &,class Point3 &)" (__imp_??0Plane@@QEAA@AEAVPoint3@@00@Z) referenced in function "public: void __cdecl P2PModData::Update(int)" (?Update_Q@P2PModData@@QEAAXH@Z)
1>c:\plugins\P2P.dlm : fatal error LNK1120: 1 unresolved externals


Many thanks....
Posted
Updated 27-Jul-11 22:04pm
v2

If this is your own library, then Emilio's answer is the right one: you just forgot to give the implementation for that constructor.

If this is a 3rd party library, then there are several possibilities:
1- they forgot to implement that constructor and you can't do anything with it (I doubt that such a mistake could be done by serious developpers...)
2- you forgot to provide the .lib file that contains the implementation for that constructor.
3- the version of the .h you are using to compile is different from the .lib you are using for linking. If you are using different versions of a SDK, check carrefully that you are not mixing files.
4- somebody (very evil) changed the .h and added a non-existing function just to bother you...

For now I don't see anything else.
 
Share this answer
 
Comments
FlurryKnox 28-Jul-11 8:37am    
I think I know the problem. I'm doing development with 3DS Max SDK and I think the problem is mixing between 32 and 64 bit libraries. I'm not sure why this would be a problem as both sets of lib files use the same header files...But I reckon this has something to do with moving to 64bit development.
Olivier Levrey 28-Jul-11 10:21am    
I agree, you probably found out where the issue comes from.
hakz.code 28-Jul-11 9:23am    
My 5,I think this covers most of the possibilities for unresolved external issues.
Olivier Levrey 28-Jul-11 10:19am    
Thank you Harish
Albert Holguin 28-Jul-11 15:30pm    
great solution, my 5
The third constructor is defined (has the {} at the end) and does nothing but calling the member constructors.
The first two are just declared.

You have to define them somewhere else in a CPP file as
ManipExport::ManipExport Plane(Point3& p1, Point3& p2, Point3& p3)
{
   //TODO: place here the code to initialize the members according with
   //the parameters
}


and similarly with the other one.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900