Undefined Reference Error When Compiling Tap To Jump Game

Hey everyone, I was looking for a way to jump on, and off objects via 2D Camera, and I see Tap To Jump has some features like this. As I added the game to the example folder using notepad++ (raylib preconfig), im getting errors when I try to compile and run the game. Here's the github source https://github.com/MarcMDE/TapToJump/

The errors I get are below::

gcc -o advance_game.exe advance_game.c -s C:\raylib\raylib\raylib_icon -Iexternal -lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,-allow-multiple-definition -Wl,--subsystem,windows
Process started >>>

AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x76): undefined reference to `InitGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0xb0): undefined reference to `UpdateLogoScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0xb5): undefined reference to `FinishLogoScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0xd3): undefined reference to `UpdateTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0xd8): undefined reference to `FinishTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0xf0): undefined reference to `FinishTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x108): undefined reference to `UpdateOptionsScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x10d): undefined reference to `FinishOptionsScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x124): undefined reference to `UpdateGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x129): undefined reference to `FinishGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x140): undefined reference to `UpdateEndingScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x145): undefined reference to `FinishEndingScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x1ab): undefined reference to `DrawLogoScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x1b2): undefined reference to `DrawTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x1b9): undefined reference to `DrawOptionsScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x1c0): undefined reference to `DrawGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x1c7): undefined reference to `DrawEndingScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x28f): undefined reference to `UnloadLogoScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x296): undefined reference to `UnloadTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x29d): undefined reference to `UnloadOptionsScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2a4): undefined reference to `UnloadGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2ab): undefined reference to `UnloadEndingScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2c6): undefined reference to `InitLogoScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2d7): undefined reference to `InitTitleScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2e8): undefined reference to `InitOptionsScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x2f9): undefined reference to `InitGameplayScreen'
AppData\Local\Temp\ccKMFfeC.o:advance_game.c:(.text+0x30a): undefined reference to `InitEndingScreen'

Comments

  • you need to use Makefile to compile that game, check raylib/templates folder for examples. On Notepad++ just use Makefile script.

    Just notice that TapToJump is a bit old game and could not be updated, so maybe it doesn't compile correctly on current version.
  • edited January 1
    Thanks, yea it dosen't compile correctly, but I decided to build my own simple jumping/colliding game. Could you give me any advice on jumping on, and off objects. I've been working on this for a few days, and I've been using the 2D Camera example to get my player rectangle to have jump collisions between 2D blocks successfully. I'm able to jump, and collide both left, and right coordinates. I've been struggling to get my player rectangle to now jump/walk on, and off other rectangles. My code example is below::

    // Main game loop
    while (!WindowShouldClose()) // Detect window close button or ESC key
    {
    // Update
    -
    if (IsKeyDown(KEY_RIGHT))
    {

    player.x += 2; // Player movement
    camera.offset.x -= 2; // Camera displacement with player movement

    }
    else if (IsKeyDown(KEY_LEFT))
    {
    player.x -= 2; // Player movement
    camera.offset.x += 2; // Camera displacement with player movement

    }

    // jump
    if (IsKeyPressed(KEY_SPACE)) {
    player.y = 160;
    }
    // put player back to ground after jump
    if (IsKeyReleased(KEY_SPACE)) {
    player.y = 280;
    }

    // loop through blocks
    for (int i = 0; i < MAX_BLOCKS; i++) {

    // check for collisions
    if (CheckCollisionRecs(player, blocks[i])) {


    if (IsKeyDown(KEY_RIGHT))
    {

    player.x -= 2;
    camera.offset.x += 2;

    }
    else if (IsKeyDown(KEY_LEFT))
    {

    player.x += 2;
    camera.offset.x -= 2;

    }


    // while jumping stop player from hitting top of block
    if(IsKeyPressed(KEY_SPACE)){

    // if player is coming down from jump, or rectangle is under player
    if(player.y >= 160 || blocks[i].y > player.y + player.height){
    player.y = blocks[i].y
    }else{

    }

    }


    }


    }
  • edited January 2
    Thanks Ray! I actually got a working Jumping 2D Camera using Raylib. Raylib made it very easy to get this to work. I used an allegro jumping demo as a reference to build my own. Here's the link for anyone else who wants to implement jumping in their game. https://wiki.allegro.cc/index.php?title=How_to_implement_jumping_in_platformers. I will also check out 2D physac as well.. :smile:
  • Hi tshoats! Great you figured it out! Thanks for the link! :)
Sign In or Register to comment.