User forums > Using Code::Blocks
lSdl3 and lSdl3main not found
(1/1)
JPF12141999:
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;
}
--- End code ---
Does anyone know where I am going wrong?
Thank you all in advance.
Miguel Gimenez:
--- Quote ---include "-l3DL3" and "-l3Dl3main"
--- End quote ---
Have you tried "-lSDL3" and "-lSDl3main"?
JPF12141999:
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?
Miguel Gimenez:
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.
Navigation
[0] Message Index
Go to full version