DevCpp & Linker Error
  • TimidonTimidon June 2004
    Well everthing was going fine. I am slowly adding functions as I build up my test app.

    I added the hgeFont Routines and now I am getting some errors. (I am currently trying to see if this error is duplicated in the later tutorials).

    I was able to run and compile Tutorial One with no problem.

    Trying Tut 2 now.

    If anybody who has ran Dev Cpp & Mingw32 has ran into a similar problem please advise.

    Thanks.

    These are the Linker Errors that I get..

    [Linker error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0' [Linker [error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0'
    [Linker error] undefined reference to `__gxx_personality_sj0'



    Also DevCpp behavios similar when you have some sort of Syntax error. Just incase here is the source code to take a look at.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    /*
    ** Haaf's Game Engine 1.4
    ** Copyright (C) 2003-2004, Relish Games
    ** hge.relishgames.com
    **
    ** hge_tut01 - Minimal HGE application
    */

     
    #include "..\..\include\hge.h"
    #include "..\..\include\hgesprite.h"
    #include "hgefont.h"
     
    HGE *hge = 0;
    // Handles for HGE resourcces
    HTEXTURE tex;
    hgeFont* fnt;
    // Sprites & Backgrounds
    hgeSprite* Iso1;
     
    float x = 50.0;
    float y = 250.0;
     
    // This function will be called by HGE once per frame.
    // Put your game loop code here. In this example we
    // just check whether ESC key has been pressed.
     
    // *************************************************************************
    // * Main Loop
    // *************************************************************************
    bool FrameFunc()
    {
    // Timer Function
    float dt=hge->Timer_GetDelta();
    // By returning "true" we tell HGE
    // to stop running the application.
    if (hge->Input_GetKeyState(HGEK_ESCAPE)) return true;
    // **************************************************
    // * Do the Behind the Scense Stuff, such as needed up to date calclations
     
    x+=0.01;
     
     
     
    // ********************
    // * Render Scence
    // ********************
     
    // ********************
    // * Main Menu
    // ********************
    hge->Gfx_BeginScene();
     
    // ********************
    // * Place Stuff
    // ********************
     
    Iso1->Render(0.0,0.0);
     
    // ********************
    // * Place Text
    // ********************
     
    fnt->printf(5,5,"dt:%.3f\nFPS:%d", dt, hge->Timer_GetFPS());
     
    // *********************
    // * End Scence
    // *********************
    hge->Gfx_EndScene();
    // Continue execution
    return false;
    }
    // *************************************************************************
    // * Loading textures
    // *************************************************************************
     
    // *************************************************************************
    // * Games Main Function - First thing looked for , ,, ,
    // *************************************************************************
     
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
    // Here we use global pointer to HGE interface.
    // Instead you may use hgeCreate() every
    // time you need access to HGE. Just be sure to
    // have a corresponding hge->Release()
    // for each call to hgeCreate()
    hge = hgeCreate(HGE_VERSION);
    // * New Stuff
    hge->System_SetState(HGE_LOGFILE, "AST.log");
    hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
    // Set the window title
    hge->System_SetState(HGE_TITLE, "Test");
    // Run in Window
    hge->System_SetState(HGE_WINDOWED, true);
    // Size
    hge->System_SetState(HGE_SCREENWIDTH, 800);
    hge->System_SetState(HGE_SCREENHEIGHT, 600);
    hge->System_SetState(HGE_SCREENBPP, 32);
    // Set our frame function
    hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
     
     
     
     
     
    // Don't use BASS for sound
    hge->System_SetState(HGE_USESOUND, false);
     
    // Tries to initiate HGE with the states set.
    // If something goes wrong, "false" is returned
    // and more specific description of what have
    // happened can be read with System_GetErrorMessage().
    if(hge->System_Initiate())
    {
    // *****************
    // * Load Font Data
    // *****************
    // fnt = new hgeFont("/graphics/fonts/font1.fnt");
    fnt=new hgeFont("font1.fnt");
    // Starts running FrameFunc().
    // Note that the execution "stops" here
    // until "true" is returned from FrameFunc().
    // bkg_1=hge->Texture_Load("bg.png");
    // Create Base
    // tex=hge->Texture_Create(64,64);
     
     
    tex=hge->Texture_Load("/graphics/gui/gui_mainbackground.png");
    Iso1 = new hgeSprite(tex,0,0,800,600);
    Iso1->SetHotSpot(0.0,00.0);
    hge->System_Start();
    }
    else
    {
    // If HGE initialization failed show error message
    MessageBox(NULL, hge->System_GetErrorMessage(), "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
    }
     
    // Now ESC has been pressed or the user
    // has closed the window by other means.
     
    // Restore video mode and free
    // all allocated resources
    // Delete Sprite Based Objects
    delete Iso1;
    // Realease Textures
    hge->Texture_Free(tex);
    hge->System_Shutdown();
     
    // Release the HGE interface.
    // If there are no more references,
    // the HGE object will be deleted.
    hge->Release();
     
    return 0;
    }


    The error did not pop up until I added the font routines. Any Ideas?
  • depsdeps June 2004
    are you sure you are using a C++ project?
    You usualy get errors like that when you are compiling a cpp file with gcc, when you should have used g++ (ot a command to gcc that i cannot remember for the moment)

    Make sure the file is named .cpp and that dev-cpp is compiling a C++ project.

    Also, dont use the default mingw that comes with dev-cpp. I had to download the newest mingw package from www.mingw.org to be able to compile some of the tutorials. (iirc the default dev-cpp mingw version is a bit old)
  • depsdeps June 2004
    After reading your post again, i really think the problem is an old mingw version.
    I remember that i had some big problems with it myself.
    Download a new mingw manually and install it, then go into dev-cpp options and tell it where the new one is.
    (That's how i did it, you can probably just overwrite the mingw inside dev-cpp somehow. but i was too lazy to find out how :) )
  • TimidonTimidon June 2004
    I went and made sure I had the latest up to date compiler the mingw3.3 (though it looks like 3.4 is in the testing phase).

    I am trying to figure out why this particular Library don't link when the first two do...

    Still getting the same linker error. Going to do some more probing. Any other ideas? (besides getting a better compiler)

    Though what is best compiler & ide used by HGE developers, I cna get A full version of MicroSoft Visual c++, 6.0 profesional is around 120$ works on my older OS (win98 and xp home).

    Though I do have the larning edition of Microsfot Visual C. Net edition (but to my surpsise it works only on the XP pro, or the Windows 2000, which I don't have). So I am tossing up to what I want to do.
  • depsdeps June 2004
    I write my code in SciTe, and compiles it using makefiles and MingW. :)
    Never been a big fan of IDE's.
  • TimidonTimidon June 2004
    I myself Like IDE's. Editor and Compiler at the switch of a button. First IDE I ever worked with was the one that came with the Turbo C 1.0 a long time ago in a reality so far away...

    But having limited funds, I have never been able to get ahold of the more professional ones, so I have had to stick to the "free" home based projects. One of the best I have treid has been Dev-Cpp.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion

Who's Online (1)