CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    1

    error LNK2001 unresolved symbol

    Code:
    #include<iostream>
    using namespace std;
    class OprOvld{
    public:
    	int var1,var2;
    	OprOvld();
    	OprOvld(int v1, int v2){
    		var1=v1;
    		var2=v2;
    	}
    	void display(){
    		cout<<var1<<endl;
    		cout<<var2<<endl;
    	}
    	OprOvld operator+ (OprOvld l);
    };
    
    OprOvld OprOvld::operator+ (OprOvld l){
    	OprOvld temp;
    	temp.var1=l.var1+var1;
    	temp.var2=l.var2+var2;
        return temp;
    }
    
    int main(int argc, char* argv[]){
    	OprOvld ov1(1,5), ov2(3,6);
    	ov1.display();
    	ov2.display();
    	ov1=ov1+ov2;
    	ov1.display();
    	return 0;
    }
    for the above program I get Linker Error.... The error is pasted below

    Linking...
    Op_Ovld.obj : error LNK2001: unresolved external symbol "public: __thiscall OprOvld::OprOvld(void)" (??0OprOvld@@QAE@XZ)
    Debug/Op_Ovld.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.




    Can some one please help me with this Issue.
    Last edited by Marc G; March 1st, 2010 at 06:34 AM. Reason: added code tags

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured