User forums > Using Code::Blocks
how to put my header of SDL
philo_neo:
Hello,
I develop in C language a graphics applications with SDL and SDL2.
my system is Fedora 28 server x86_64.
my problem is that I do not arrive in settings >> globals variables...
Address the header of the SDL (.h), so the addition of the directive <SDL.h> is in error.
the installation of the SDL is in the following directory: /usr/include/SDL or /usr/include/SDL2
Question, how to put my header in Code:: blocks?
Regards
Philippe
headkase:
I'm not entirely sure but I think you need to include:
#include <SDL2/SDL.h>
Instead of
#include <SDL.h>
This is a vague impression though, I think the change to preface with "SDL2/" was made because of compatibility with SDL 1.
philo_neo:
yes but my main problem is that in the menu >> Settings >> global variables...
Code:: bloks can not find the directory path of the SDL or SDL2,
How to declare my header (all *.h) in code:: blocks 17.12.
headkase:
It's sounding like you need to set up your include and libs folders. See these instructions for doing it with SFML:
https://www.sfml-dev.org/tutorials/2.5/start-cb.php
Do the same thing but with the SDL2 folder paths instead.
Just set up the include and lib folders, everything else is specific to SFML and not SDL2.
philo_neo:
with this code
--- Code: ---#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO); // Démarrage de la SDL (ici : chargement du système vidéo)
/*
La SDL are loaded.
program loaded, write your code here !!!
*/
SDL_Quit(); // Arrêt de la SDL (libération de la mémoire).
return 0;
}
--- End code ---
this is my output of built log !
--- Quote ----------------- Build: Debug in test_sdl2_101 (compile: GNU GCC Compiler) ---------------
gcc -Wall -g -I ../../../../../ usr / include / SDL -c /home/phipo/c/perso/essai_sdl2_101/main.c -o obj / Debug / main .o
g ++ -L / usr / include / SDL -L / usr / include / SDL2 -o bin / Debug / test_sdl2_101 obj / Debug / main.o
obj / Debug / main.o: In the "main" function:
/home/phipo/c/perso/essai_sdl2_101/main.c:11: Indefinite reference to "SDL_Init"
/home/phipo/c/perso/essai_sdl2_101/main.c:25: Indefinite reference to "SDL_Quit"
collect2: error: ld returned output status 1
Process terminated with status 1 (0 minute (s), 0 second (s))
1 error (s), 0 warning (s) (0 minute (s), 0 second (s))
--- End quote ---
Should you make a program with an initialization of the SDL?
Navigation
[0] Message Index
[#] Next page
Go to full version