×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Italy
    Posts
    3

    Link Error with own class

    Hi,

    I defined my own class as follow, implemented all the methods, include the source in mmp file, but I still get these errors from the linker

    Building resources from ..\data\tris_caption.rss
    perl -S epocrc.pl -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC" -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP" -I "..\..\..\..\..\..\..\..\..\..\..\..\
    ..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\INC" -I- -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP" -I "..\..\..\..\..\..\..\..\..\..\..\..\..\Programmi\Symbian6.1\Series60\EPOC32\INCLUDE" -DLANG
    UAGE_SC -u "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\..\DATA\TRIS_CAPTION.RSS" -o"\Programmi\Symbian6.1\Series60\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\TRIS\TRIS_CAPTION.rSC" -h"..\..\..\..\..\..\..\..
    \..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\TRIS_CAPTION.rs~" -t"\Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB"
    1 file copiati.
    echo this is a dummy output file > "\Programmi\Symbian6.1\Series60\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\TRIS\TRIS_CAPTION.rSC.dummy"
    call "MayRewriteHdr.bat"
    del "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\TRIS_CAPTION.rs~"
    Building resources from ..\data\tris.rss
    perl -S epocrc.pl -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC" -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP" -I "..\..\..\..\..\..\..\..\..\..\..\..\
    ..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\INC" -I- -I "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP" -I "..\..\..\..\..\..\..\..\..\..\..\..\..\Programmi\Symbian6.1\Series60\EPOC32\INCLUDE" -DLANG
    UAGE_SC -u "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\..\DATA\TRIS.RSS" -o"\Programmi\Symbian6.1\Series60\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\TRIS\TRIS.rSC" -h"..\..\..\..\..\..\..\..\..\..\..\..\..\
    PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\TRIS.rs~" -t"\Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB"
    1 file copiati.
    echo this is a dummy output file > "\Programmi\Symbian6.1\Series60\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\TRIS\TRIS.rSC.dummy"
    call "MayRewriteHdr.bat"
    del "..\..\..\..\..\..\..\..\..\..\..\..\..\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\SRC\TRIS.rs~"
    Compiling...
    Trisapp.cpp
    Trisappui.cpp
    Triscontainer.cpp
    Trisdocument.cpp
    Tris.uid.cpp
    TrisGame.cpp
    Generating Code...
    Doing first-stage link by name
    link.exe @C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\nma00436.
    Creating library \Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB\TRIS.lib and object \Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TR
    IS\WINS\UDEB\TRIS.exp
    TRISCONTAINER.obj : error LNK2001: unresolved external symbol "public: __thiscall CTrisGame::CTrisGame(void)" (??0CTrisGame@@QAE@XZ)
    TRISCONTAINER.obj : error LNK2001: unresolved external symbol "public: void __thiscall CTrisGame::switchPlayer(void)" (?switchPlayer@CTrisGame@@QAEXXZ)
    TRISCONTAINER.obj : error LNK2001: unresolved external symbol "public: int __thiscall CTrisGame::getPlayer(void)const " (?getPlayer@CTrisGame@@QBEHXZ)
    \Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB\TRIS.APP : fatal error LNK1120: 3 unresolved externals
    NMAKE : fatal error U1077: 'link.exe' : return code '0x460'
    Stop.
    if exist "\Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB\TRIS.exp" del "\Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB\T
    RIS.exp"
    Stopped the build by removing the export object,
    if present, because the pre-link stage failed
    Linking...
    LINK : fatal error LNK1104: cannot open file "\Programmi\Symbian6.1\Series60\EPOC32\BUILD\PROGRAMMI\SYMBIAN6.1\SERIES60\SERIES60EX\TRIS\GROUP\TRIS\WINS\UDEB\TRIS.exp"
    Error executing link.exe.

    TRIS.APP - 6 error(s), 0 warning(s)

    And here is the code i wrote

    //
    //header file
    //

    #ifndef TRISGAME_H
    #define TRISGAME_H

    // INCLUDES
    #include <e32def.h>
    #include <e32base.h>

    // CONSTANTS
    const TInt KSize = 3;
    const TInt KPl1 = 1;
    const TInt KPl2 = 2;

    // CLASS DECLARATION

    class CTrisGame : public CBase
    {

    public:
    CTrisGame();
    ~CTrisGame();

    TInt getPlayer() const;
    void switchPlayer();

    TInt getMovement(const TInt x, const TInt y) const;
    void setMovement(const TInt x, const TInt y);

    private:
    TInt iPlayer; //Current Player
    TInt iMovement[KSize][KSize]; //Current movemnt situation

    };

    #endif

    //
    //cpp source file
    //

    // INCLUDE FILES
    #include "TrisGame.h"

    CTrisGame::CTrisGame(){
    for(TInt i = 0; i < 3; i++)
    for(TInt j = 0; j < 3; j++)
    iMovement[i][j] = 0;
    iPlayer = KPl1;
    }

    CTrisGame::~CTrisGame(){
    }

    TInt CTrisGame::getPlayer() const{
    return iPlayer;
    }

    void CTrisGame::switchPlayer(){
    if(iPlayer == KPl1)
    iPlayer = KPl2;
    else
    iPlayer = KPl1;
    }

    TInt CTrisGame::getMovement(const TInt x, const TInt y) const{
    return iMovement[x][y];
    }

    void CTrisGame::setMovement(const TInt x, const TInt y){
    iMovement[x][y] = iPlayer;
    }

    //
    //Project file
    //

    TARGET Tris.app
    TARGETTYPE app
    UID 0x100039CE 0x08EDA0F7
    TARGETPATH \system\apps\Tris

    SOURCEPATH ..\src
    SOURCE TrisApp.cpp
    SOURCE TrisAppUi.cpp
    SOURCE TrisDocument.cpp
    SOURCE TrisContainer.cpp
    SOURCE TrisGame.cpp

    RESOURCE ..\data\Tris.rss
    RESOURCE ..\data\Tris_caption.rss
    LANG SC

    USERINCLUDE . ..\inc

    SYSTEMINCLUDE . \epoc32\include

    LIBRARY euser.lib apparc.lib cone.lib eikcore.lib
    LIBRARY eikcoctl.lib avkon.lib

    START WINS
    // ?wins_specific_information
    END

    START MARM
    // ?marm_specific_information
    END

    // Other possible keywords:
    /*
    START BITMAP ?target
    TARGETPATH ?emulated_path_on_target_machine
    HEADER
    SOURCEPATH ?source_path
    SOURCE ?color_depth ?source_bitmap_list
    END
    */
    // DEFFILE ?filename

    AIF Tris.aif ..\aif Trisaif.rss c8 context_pane_icon.bmp context_pane_icon_mask.bmp list_icon.bmp list_icon_mask.bmp



    what is wrong???

    thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    hi

    basically "unresolved external symbol " means that the header file defining the class and it's functions was found, but the function implementation was not.

    So check that you mmp file includes the cpp file that has the function implementations in it and then re-build your workspace, so the changes in mmp file will take effect. and try building again.

    yucca

  3. #3
    Registered User
    Join Date
    Mar 2003
    Location
    Italy
    Posts
    3
    Actually, I did what you said to me. The code posted before is the TrisGame.cpp file, already included in the mmp file. But it still doesn't work... :(

    any other idea?

    thanks

  4. #4
    Registered User
    Join Date
    Dec 2003
    Location
    Germany
    Posts
    9
    Did you rebuild your makefile? I had a similar problem adding my own classes. Everything compiled alright, but I could not link (getting the same error message) the obj-files.

    After rebuilding the makefiles using "abld makefile vc6" this solved my problem (compiling and running using VC++ 6.0).

    BTW: there should be an addin for VC++ 6.0 to rebuild the makefiles and add custom classes. But for some reason this addin wont work on my system :( has anyone used this addin successful?

Posting Permissions

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