[RESOLVED] error LNK2019 unresolved external symbol
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: [RESOLVED] error LNK2019 unresolved external symbol

  1. #1
    Join Date
    Jul 2017
    Posts
    6

    [RESOLVED] error LNK2019 unresolved external symbol

    How come im getting these errors?
    1>CrateDemo.obj : error LNK2019: unresolved external symbol "public: float __thiscall IvVector3::Length(void)const " (?Length@IvVector3@@QBEMXZ) referenced in function "public: float __thiscall CameraApp::SegmentArcLength(unsigned int,float,float)" (?SegmentArcLength@CameraApp@@QAEMIMM@Z)
    1>CrateDemo.obj : error LNK2019: unresolved external symbol "public: __thiscall IvVector3::IvVector3(class IvVector3 const &)" (??0IvVector3@@QAE@ABV0@@Z) referenced in function "public: float __thiscall CameraApp::SegmentArcLength(unsigned int,float,float)" (?SegmentArcLength@CameraApp@@QAEMIMM@Z)
    1>CrateDemo.obj : error LNK2019: unresolved external symbol "public: class IvVector3 __thiscall IvVector3:perator+(class IvVector3 const &)const " (??HIvVector3@@QBE?AV0@ABV0@@Z) referenced in function "public: float __thiscall CameraApp::SegmentArcLength(unsigned int,float,float)" (?SegmentArcLength@CameraApp@@QAEMIMM@Z)

    Code:
    class CameraApp : public IvVector3
    {
    
    public:
        CameraApp();
    
        bool InitializeNatural( const IvVector3* positions, const float* times, unsigned int count );
        IvVector3 mPositions[5];
        IvVector3 mInTangents[4];
        IvVector3 mOutTangents[4];
        float mTimes[5];
        float mCount[5];
        static int count;
        float mLengths[4];
        static float mTotalLength;
        float SegmentArcLength( UInt32 i, float u1, float u2 );
    };
    
    
    int CameraApp::count = 5;
    float CameraApp::mTotalLength = 0.0f;
    float CameraApp::SegmentArcLength( UInt32 i, float u1, float u2 )
    {
        static const float x[] =
        {
            0.0000000000f, 0.5384693101f, -0.5384693101f, 0.9061798459f, -0.9061798459f 
        };
    
        static const float c[] =
        {
            0.5688888889f, 0.4786286705f, 0.4786286705f, 0.2369268850f, 0.2369268850f
        };
    
    
    
        if ( u2 <= u1 )
            return 0.0f;
    
        if ( u1 < 0.0f )
            u1 = 0.0f;
    
        if ( u2 > 1.0f )
            u2 = 1.0f;
    
        // use Gaussian quadrature
        float sum = 0.0f;
        // set up for computation of IvHermite derivative
        IvVector3 A = 2.0f*mPositions[i]
                    - 2.0f*mPositions[i+1]
                    + mInTangents[i]
                    + mOutTangents[i];
        IvVector3 B = -3.0f*mPositions[i]
                    + 3.0f*mPositions[i+1]
                    - mInTangents[i]
                    - 2.0f*mOutTangents[i];
        IvVector3 C = mInTangents[i];
    
        for ( UInt32 j = 0; j < 5; ++j )
        {
            float u = 0.5f*((u2 - u1)*x[j] + u2 + u1);
            IvVector3 derivative = C + u*(2.0f*B + 3.0f*u*A);
            sum += c[j]*derivative.Length();
        }
        sum *= 0.5f*(u2-u1);
    
        return sum;
    
    }   // End of IvHermite::SegmentArcLength()
    bool CameraApp::InitializeNatural( const IvVector3* positions, 
                                  const float* times,
                                  unsigned int count )
    {
        // make sure not already initialized
        if (mCount != 0)
            return false;
    
        // make sure data is valid
        if ( count < 3 || !positions || !times )
            return false;
    
    
    
        // copy positions and times
        for ( unsigned int i = 0; i < count; ++i )
        {
            mPositions[i] = positions[i];
            mTimes[i] = times[i];
        }
    
        // build tangent data
        unsigned int n = count;
        float L;                          // current lower diagonal matrix entry
        float* U = new float[n];          // upper diagonal matrix entries
        IvVector3* z = new IvVector3[n];  // solution of lower diagonal system Lz = b
    
        // solve for upper matrix and partial solution z
        L = 2.0f;
        U[0] = 0.5f;
        z[0] = 3.0f*(positions[1] - positions[0])/L;
        for ( unsigned int i = 1; i < n-1; ++i )
        {
            // add internal entry to linear system for smooth spline
            L = 4.0f - U[i-1];
            U[i] = 1.0f/L;
            z[i] = 3.0f*(positions[i+1] - positions[i-1]);
            z[i] -= z[i-1];
            z[i] /= L;
        }
        L = 2.0f - U[n-2];
        z[n-1] = 3.0f*(positions[n-1] - positions[n-2]);
        z[n-1] -= z[n-2];
        z[n-1] /= L;
    
        // solve Ux = z (see Burden and Faires for details)
        mInTangents[n-2] = z[n-1];
        for ( unsigned int i = n-2; i > 0; --i )
        {
            mInTangents[i-1] = z[i] - U[i]*mInTangents[i];
            mOutTangents[i] = mInTangents[i-1];
        }
        mOutTangents[0] = z[0] - U[0]*mInTangents[0];
    
        // set up curve segment lengths
    
        mTotalLength = 0.0f;
        for ( unsigned int i = 0; i < count-1; ++i )
        {
            mLengths[i] = SegmentArcLength(i, 0.0f, 1.0f);
            mTotalLength += mLengths[i];
        }
    
        delete [] U;
        delete [] z;
    
    
    
        return true;
    
    }   // End of IvHermite::InitializeNatural()

  2. #2
    Join Date
    Jul 2017
    Posts
    6

    Re: error LNK2019 unresolved external symbol

    Code:
    //===============================================================================
    // @ IvVector3.h
    // 
    // 3D vector class
    // ------------------------------------------------------------------------------
    // Copyright (C) 2008-2015 by James M. Van Verth and Lars M. Bishop.
    // All rights reserved.
    //
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //===============================================================================
    
    #ifndef __IvVector3__h__
    #define __IvVector3__h__
    
    //-------------------------------------------------------------------------------
    //-- Dependencies ---------------------------------------------------------------
    //-------------------------------------------------------------------------------
    
    #include "IvWriter.h"
    
    //-------------------------------------------------------------------------------
    //-- Typedefs, Structs ----------------------------------------------------------
    //-------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------
    //-- Classes --------------------------------------------------------------------
    //-------------------------------------------------------------------------------
    
    class IvMatrix33;
    
    class IvVector3
    {
        friend class IvLine3;
        friend class IvLineSegment3;
        friend class IvMatrix33;
        friend class IvMatrix44;
        friend class IvPlane;
        friend class IvQuat;
        friend class IvRay3;
        
    public:
        // constructor/destructor
        inline IvVector3() {}
        inline IvVector3( float _x, float _y, float _z ) :
            x(_x), y(_y), z(_z)
        {
        }
        inline ~IvVector3() {}
    
        // copy operations
        IvVector3(const IvVector3& other);
        IvVector3& operator=(const IvVector3& other);
    
        // text output (for debugging)
        friend IvWriter& operator<<(IvWriter& out, const IvVector3& source);
    
        // accessors
        inline float& operator[]( unsigned int i )          { return (&x)[i]; }
        inline float operator[]( unsigned int i ) const { return (&x)[i]; }
    
        float Length() const;
        float LengthSquared() const;
    
        friend float Distance( const IvVector3& p0, const IvVector3& p1 );
        friend float DistanceSquared( const IvVector3& p0, const IvVector3& p1 );
    
        // comparison
        bool operator==( const IvVector3& other ) const;
        bool operator!=( const IvVector3& other ) const;
        bool IsZero() const;
        bool IsUnit() const;
    
        // manipulators
        inline void Set( float _x, float _y, float _z );
        void Clean();       // sets near-zero elements to 0
        inline void Zero(); // sets all elements to 0
        void Normalize();   // sets to unit vector
    
        // operators
    
        // addition/subtraction
        IvVector3 operator+( const IvVector3& other ) const;
        friend IvVector3& operator+=( IvVector3& vector, const IvVector3& other );
        IvVector3 operator-( const IvVector3& other ) const;
        friend IvVector3& operator-=( IvVector3& vector, const IvVector3& other );
    
        IvVector3 operator-() const;
    
        // scalar multiplication
        IvVector3   operator*( float scalar );
        friend IvVector3    operator*( float scalar, const IvVector3& vector );
        IvVector3&          operator*=( float scalar );
        IvVector3   operator/( float scalar );
        IvVector3&          operator/=( float scalar );
    
        // dot product/cross product
        float               Dot( const IvVector3& vector ) const;
        friend float        Dot( const IvVector3& vector1, const IvVector3& vector2 );
        IvVector3           Cross( const IvVector3& vector ) const;
        friend IvVector3    Cross( const IvVector3& vector1, const IvVector3& vector2 );
    
        // matrix products
        friend IvVector3 operator*( const IvVector3& vector, const IvMatrix33& mat );
     
        // useful defaults
        static IvVector3    xAxis;
        static IvVector3    yAxis;
        static IvVector3    zAxis;
        static IvVector3    origin;
        
        // member variables
        float x, y, z;
    };
    
    float Distance( const IvVector3& p0, const IvVector3& p1 );
    float DistanceSquared( const IvVector3& p0, const IvVector3& p1 );
    
    //-------------------------------------------------------------------------------
    //-- Inlines --------------------------------------------------------------------
    //-------------------------------------------------------------------------------
    
    //-------------------------------------------------------------------------------
    // @ IvVector3::Set()
    //-------------------------------------------------------------------------------
    // Set vector elements
    //-------------------------------------------------------------------------------
    inline void 
    IvVector3::Set( float _x, float _y, float _z )
    {
        x = _x; y = _y; z = _z;
    }   // End of IvVector3::Set()
    
    //-------------------------------------------------------------------------------
    // @ IvVector3::Zero()
    //-------------------------------------------------------------------------------
    // Zero all elements
    //-------------------------------------------------------------------------------
    inline void 
    IvVector3::Zero()
    {
        x = y = z = 0.0f;
    }   // End of IvVector3::Zero()
    
    //-------------------------------------------------------------------------------
    //-- Externs --------------------------------------------------------------------
    //-------------------------------------------------------------------------------
    
    #endif

  3. #3
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,994

    Re: error LNK2019 unresolved external symbol

    Quote Originally Posted by terrysworkstation View Post
    How come im getting these errors?
    Code:
    1>CrateDemo.obj : error LNK2019: unresolved external symbol "public: float __thiscall IvVector3::Length(void)const " (?Length@IvVector3@@QBEMXZ) referenced in function "public: float __thiscall CameraApp::SegmentArcLength(unsigned int,float,float)" (?SegmentArcLength@CameraApp@@QAEMIMM@Z)
    ...
    You have declared the
    Code:
        float Length() const;
    in the IvWriter.h file, but you seem to forget or miss to implement it!

    The same - for other errorrs...
    Victor Nijegorodov

  4. #4
    Join Date
    Jul 2017
    Posts
    6

    Re: error LNK2019 unresolved external symbol

    Fixed now. Problem solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)