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

Thread: linking error

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Posts
    20

    Post linking error

    Hi please help. I am new to Visual C++ and I don't know how to solve these problems. Here is my code:

    //LinesDialog.h
    #include "LinesDraw.h"
    ldraw.hello(); //hello function would then be called

    //LinesDraw.h
    public:
    void hello();//hints that hello() exists

    //LinesDraw.cpp
    public: int num;
    void LinesDraw::hello(){ //what the hello function does
    num=3;
    }
    Cosgen.cpp is my main function.

    And here is the linking error that I got:
    LinesDraw.obj : error LNK2028: unresolved token (0A000011) "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
    Cosgen.obj : error LNK2028: unresolved token (0A00003E) "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
    Cosgen.obj : error LNK2019: unresolved external symbol "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
    LinesDraw.obj : error LNK2001: unresolved external symbol "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ)
    C:\SP_C++\Cosgen\Debug\Cosgen.exe : fatal error LNK1120: 3 unresolved externals

    I tried to google and stalk in some forums but I couldn't solve it.
    Help from you expert people would be very much appreciated.

    And I hoped that I am in the right forum.
    Anyway, Cosgen is the name of my project.
    Thanks!

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: linking error

    This code makes no sense. Please post the actual code.

    There error messages say that there are functions that are declared (in a header) but not implemented (in a cpp file), so that the linker doesn't find the body and link it in the resulting executable.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

Tags for this Thread

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