• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Rookie Coder

SDL Permission denied

8 posts in this topic

Hello All,

 

I am using Code Blocks IDE and SDL. When I was coding in SDL for putting images on the screen and run the program. It worked fine. I decide to change window size then I run the program again but It say SDL Permission denied !

 

How can I fixed that?

0

Share this post


Link to post
Share on other sites

Post your actual error message.

 

Likely, you were compiling, but your previous build was still running in the background, so your compiler couldn't erase the old exe and write the new exe, because you can't delete an exe that the OS is currently running.

 

tldr: Make sure your executable is closed before recompiling.

0

Share this post


Link to post
Share on other sites

SDL FOLDER

 

118hi54.jpg

 

 

SDL >> BIN Folder

 

ngzz3d.jpg

 

SDL >> BIN >> Debug Folder

 

2q1827a.jpg

 

SDL >> BIN >> Release

 

2qnwok4.jpg

 

 

Code Block IDE with SDL Code

 

v3ke94.jpg

0

Share this post


Link to post
Share on other sites

What Do I need to do to stop from Happening again because I always changing code every time I run the program to make better and adding some stuffs on screen

 

 

 

tldr: Make sure your executable is closed before recompiling.

 

 

Hmmm...how do I do that?

Edited by Noob C++
0

Share this post


Link to post
Share on other sites
Let's break down the error. The source is ld.exe, which is the Linker. The Linker's job is to produce an executable from the various object files, and any libraries. The message mentions C:\Users\DMC\Desktop\SDL\main.exe, so this would be the executable you're building. The message says it cannot open the file due to a permission error. Windows is designed such that any executable file which currently has a running process cannot be modified or deleted. A very likely source of this error is that your program is still running, but you're trying to recompile. There are other ways you could get this error but they are less likely.

How do you avoid this error? The simplest case is where you can see the program's UI Window - simply exit the program, perhaps using the red X in the corner, or hitting the Escape key if you've written your program to close in response to this. It can be handy to implement such a key in Debug mode to speed up development.

You might have a problem if you've introduced a bug in your code where it will not exit when told, or you might be running a program that enters an infinite loop / deadlocks before there is any Window to close.

In this case, if the process is launched from your IDE you may be able to "break into" it using the Debugger to investigate the source of the bug, or simple terminate it if you believe you know what is wrong.

If you cannot see a UI, and your IDE isn't running the process, you can open the Task Manager and try to locate the process there and terminate it. Be careful - if you terminate the wrong process, such as your IDE, you may lose any unsaved work!

If that still doesn't work, there are other possible causes, but as mentioned they are not very likely.
1

Share this post


Link to post
Share on other sites

Thanks for reply and I know what you mean....
 
My code

#include "SDL/SDL.h"

//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;

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

//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Set up screen
screen = SDL_SetVideoMode(640, 320, 32, SDL_SWSURFACE );

//Load image
hello = SDL_LoadBMP( "STARFIELDS.BMP" );

//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen
SDL_Flip( screen );

//Pause
SDL_Delay( 2000 );

//Free the loaded image
SDL_FreeSurface( hello );

//Quit SDL
SDL_Quit();

return 0;
}

Edited by Noob C++
0

Share this post


Link to post
Share on other sites

Thanks for reply and I know what you mean....

To me, this reads like you understand the problem and how to solve it in future ... but then you also posted your code, do you have another question?
0

Share this post


Link to post
Share on other sites

I was showing what my code but is there where key can press by user if he/she want press escape key to quit?

0

Share this post


Link to post
Share on other sites
That program looks like it would quit automatically after about two seconds, provided no errors occur which would cause it to behave otherwise. If you want it to respond to the close window button, or to the escape key, you'd need to add a little input loop.

While in practise an error (e.g. no STARFIELDS.BMP file is found) may either be compensated for by checks in the rest of the code, or may cause a segfault, that you are doing no error checking and recovery means that it is possible that your program invokes undefined behaviour, which means that your process might do unexpected things (such as hang).

Here is your program but with error checking added to the initialisation functions:
#include "SDL.h"
#include <iostream>

//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;

int main( int argc, char* args[] )
{
    //Start SDL
    if(SDL_Init( SDL_INIT_EVERYTHING ) < 0) {
        std::cerr << "Failed to initialise SDL: " << SDL_GetError() << std::endl;
        return 1;
    }

    //Set up screen
    screen = SDL_SetVideoMode(640, 320, 32, SDL_SWSURFACE );
    if(!screen) {
        std::cerr << "Failed to set video mode: " << SDL_GetError() << std::endl;
        SDL_Quit();
        return 1;
    }

    //Load image
    hello = SDL_LoadBMP( "STARFIELDS.BMP" );
    if(!hello) {
        std::cerr << "Failed to load image: " << SDL_GetError() << std::endl;
        SDL_Quit();
        return 1;
    }

    //Apply image to screen
    SDL_BlitSurface( hello, NULL, screen, NULL );

    //Update Screen
    SDL_Flip( screen );

    //Pause
    SDL_Delay( 2000 );

    //Free the loaded image
    SDL_FreeSurface( hello );

    //Quit SDL
    SDL_Quit();

    return 0;
}
SDL_BlitSurface() and SDL_Flip() can also fail, so for full correctness you'd need to add similar logic at these points too.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0