2017-04-15 2 views
0

J'ai cherché mais je n'ai pas pu trouver un problème similaire au mien. Merci pour toute aide! J'utilise SDL dans les blocs de code sur un Mac.Programme de test pour SDL - "Aucun fichier ou répertoire"

I installé SDL selon ce tutoriel: https://www.youtube.com/watch?v=Bi9BPEwEMDU&t=5s

Voici comment configurer le compilateur et éditeur de liens en C :: B selon la vidéo:

Paramètres du compilateur:

+Search directories+ 
/usr/local/Cellar/sdl2/2.0.5/include/SDL2 

+Linker+ 
/usr/local/lib 

Linker Réglages

+Link Libraires+ 
/usr/local/lib/libSDL2_test.a 
/usr/local/lib/libSDL2-2.0.0.dylib 
/usr/local/lib/libSDL2.a 
/usr/local/lib/libSDL2main.a 

Le programme de test construit, mais la fenêtre du terminal états:

~ Buckwheat$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Buckwheat/Documents/Code Blocks Projects/o/bin/Debug/o 

sh: /Users/Buckwheat/Documents/Code: No such file or directory 

Process returned 127 (0x7F) execution time : 0.002 s 

Voici le programme de test:

// Example program: 
// Using SDL2 to create an application window 

#include "SDL.h" 
#include <stdio.h> 

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

    SDL_Window *window;     // Declare a pointer 

    SDL_Init(SDL_INIT_VIDEO);    // Initialize SDL2 

    // Create an application window with the following settings: 
    window = SDL_CreateWindow(
     "An SDL2 window",     // window title 
     SDL_WINDOWPOS_UNDEFINED,   // initial x position 
     SDL_WINDOWPOS_UNDEFINED,   // initial y position 
     640,        // width, in pixels 
     480,        // height, in pixels 
     SDL_WINDOW_OPENGL     // flags - see below 
    ); 

    // Check that the window was successfully created 
    if (window == NULL) { 
     // In the case that the window could not be made... 
     printf("Could not create window: %s\n", SDL_GetError()); 
     return 1; 
    } 

    // The window is open: could enter program loop here (see SDL_PollEvent()) 

    SDL_Delay(3000); // Pause execution for 3000 milliseconds, for example 

    // Close and destroy the window 
    SDL_DestroyWindow(window); 

    // Clean up 
    SDL_Quit(); 
    return 0; 
} 

Répondre

0

Votre chemin contient des espaces:

/Users/Buckwheat/Documents/Code Blocks Projects/o/bin/Debug/o 

Et votre shell prend la partie du chemin avant que l'espace comme un argument distinct:

sh: /Users/Buckwheat/Documents/Code: No such file or directory 

Vous devez échapper aux caractères espaces comme celui-ci:

/Users/Buckwheat/Documents/Code\ Blocks\ Projects/o/bin/Debug/o 
+0

Ahhhhh! Merci beaucoup! Voyant que la fenêtre SDL est satisfaisante. –