Author Topic: lSdl3 and lSdl3main not found  (Read 353 times)

Offline JPF12141999

  • Single posting newcomer
  • *
  • Posts: 2
lSdl3 and lSdl3main not found
« on: Yesterday at 02:04:39 am »
Hi everyone,

When using the 3/14/2020 version of Code::Blocks and the 3.2.26 version of SDL3, I get told when I type in the linker settings to include "-l3DL3" and "-l3Dl3main", that it cannot find those things even though when I Google for help with SDL3 and Code::Blocks the results tell me specifically to type those things in the linker word for word.

This is my program so far:

Code
#define SDL_MAIN_HANDLED
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <iostream>

int main(int argc, char* args[]) {
    SDL_Window* window = nullptr;
    SDL_Renderer* renderer = nullptr;

    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        // Handle error
        return 1;
    }

    window = SDL_CreateWindow("My 2D Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOW_VULKAN);
    if (!window) {
        // Handle error
        SDL_Quit();
        return 1;
    }

    renderer = SDL_CreateRenderer(window, "Render");
    if (!renderer) {
        // Handle error
        SDL_DestroyWindow(window);
        SDL_QuitEvent();
        return 1;
    }

    bool quit = false;
    SDL_Event e;

    while (!quit) {
        while (SDL_PollEvent(&e) != 0) {
            if (e.type == SDL_EVENT_QUIT) {
                quit = true;
            }
        }

        SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); // White background
        SDL_RenderClear(renderer);

        // Draw game objects here (e.g., textures, shapes)

        SDL_RenderPresent(renderer);
    }

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}

Does anyone know where I am going wrong?

Thank you all in advance.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1795
Re: lSdl3 and lSdl3main not found
« Reply #1 on: Yesterday at 09:13:06 am »
Quote
include "-l3DL3" and "-l3Dl3main"

Have you tried "-lSDL3" and "-lSDl3main"?

Offline JPF12141999

  • Single posting newcomer
  • *
  • Posts: 2
Re: lSdl3 and lSdl3main not found
« Reply #2 on: Yesterday at 12:18:55 pm »
Unless I misunderstood, you can see in my post I tried that word for word already and got the error anyway.Maybe I should just watch on YouTube a tutorial that tells me how to make a 2D game with Code::Blocks without SDL3?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1795
Re: lSdl3 and lSdl3main not found
« Reply #3 on: Yesterday at 01:21:16 pm »
You used a "3" (number three) instead of an "S" (letter) in both file names, please check your typing.

Just add "SDL3" and "SDL3main" to the libraries list (the left one), and add SDL3 location to the compiler's and linker's search directories.

If you still have compilation problems read this.