User forums > Using Code::Blocks

how to put my header of SDL

<< < (2/2)

philo_neo:
with this program I should get the window as an attachment


--- Code: ---#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <SDL2/SDL.h>

void pause();



int main(int argc, char *argv[])

{
    SDL_Init(SDL_INIT_VIDEO); // Initialisation de la SDL
    SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); // Ouverture de la fenĂȘtre
    pause(); // Mise en pause du programme
    SDL_Quit(); // ArrĂȘt de la SDL
    return EXIT_SUCCESS; // Fermeture du programme
}

void pause()
{
    int continuer = 1;
    SDL_Event event;
    while (continuer)
    {
        SDL_WaitEvent(&event);
        switch(event.type)
        {
            case SDL_QUIT:
                continuer = 0;
        }
    }
}

--- End code ---
rhe swall image !!


sodev:
You don't have a compilation problem, you have a linking problem. Your headers are found fine, the problem is that you don't link to any SDL library. You have to add the required libraries to the link libraries.

philo_neo:
Then password (You can remove SDL_image and SDL_ttf if you do not need it, but if you follow m @ teo tutorial, you will need it at one time or another).

Then, in codeblocks, it is enough to make new SDL project, and normally it compiles alone (on the other hand, withdraws the main.cpp of the project, replaces it by main.c, saves in user-template to avoid having to do again the manipulation each time: you can call it SDL C). By default code :: blocks uses C ++ with SDL, and not C, the user template avoids this.



Post // thread SOLVED

Navigation

[0] Message Index

[*] Previous page

Go to full version