Jump to content
  • Advertisement
Sign in to follow this  
ph33r

Linker Errors with a .lib

This topic is 4797 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

So I've created a .lib that has all my base code. Though for some reason when ever I try to use a function in my library that references another function within the same library I get a linker error. Is it not possible to do this, More specifically... // God is this ugly... SampleApp error LNK2019: unresolved external symbol "float __cdecl math::Vector3DotProduct(class math::Vector3 const &,class math::Vector3 const &)" (?Vector3DotProduct@math@@YAMABVVector3@1@0@Z) referenced in function "class math::Vector3 __cdecl Vector3Projection(class math::Vector3 const &,class math::Vector3 const &)" (?Vector3Projection@@YA?AVVector3@math@@ABV12@0@Z) So here is where I get the referenced in part of the function
void Vector3Projection( const Vector3& u, const Vector3& v, Vector3& returnVec )
{
	float magnitude = math::Vector3Length( v );

	if( magnitude )
		returnVec = ( ( math::Vector3DotProduct( u, v ) / ( magnitude * magnitude ) ) * v );
}
Here is the prototype for DotProduct float Vector3DotProduct ( const Vector3& vec1, const Vector3& vec2 ); And here is the implementation float Vector3DotProduct( const Vector3& vec1, const Vector3& vec2 ) { return ( vec1.x * vec2.x ) + ( vec1.y * vec2.y ) + ( vec1.z * vec2.z ); }

Share this post


Link to post
Share on other sites
Advertisement
Did you also put the definition of Vector3DotProduct inside the math namespace? If you didn't, then you defined the function ::Vector3DotProduct, not math::Vector3DotProduct.

Share this post


Link to post
Share on other sites
Crap, I just put using namespace math; at the top of the .cpp file.

Thank you so much! ++

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!