Permission denied

Pages: 123
I would just say delete it all since it is just a test and then create a new project..
Well, i've done this, and it works for the default code (THe hello world) but the moment I add the code in my code, the console execute itself but not the code (Would my code be incorrect? THat's without the cin.get(); ) WHen I retry to recompile a few more times, that's when the problem arrives. ...
To be honest I don't understand what you are saying...and go to the task manager. Click on the processes tab and look for the .exe and close it...
Where are your project files located anyway?
lol sorry giblit, didnt notice I wrote non sense xD (I should maybe re-read myself.) My project are in a file called c++

Anyway, forget it, now, I just want someone to explain me why my code doesn't run properly. That's where the problem started..
And what problem was that? The console closing prematurely for which Blanchy suggested cin.get()? Or something unrelated?
Well, concerning the code in my first post. The console openned, but it didn't execute my code... (It didn't do what it was supposed to do.) I just want to learn from my error!
What exactly do you mean by "it didn't do what it was supposed to do." To me it looks like it does exactly what it is supposed to do. Output a message I'm guessing how old are you, but I could be wrong I don't speak french or what ever language that is. Then it takes in an input. Then it outputs something with the input then something else.

1
2
3
4
5
6
7
8
9
10
#include <iostream>

int main()
{
    int age; //can use a string also like you have doesn't matter.
    std::cout << "How old are you? " << std::flush;
    std::cin >> age;
    std::cout << "You are " << age << " year(s) old." << std::endl;
    return( 0 );
}


I would also suggest something like
1
2
3
4
5
while( !std::cin >> age || age < 0 || age > 110 )
{
    std::cin.clear();
    std::cin.ignore( std::numeric_limits<std::streamsize>::max() , '\n' );
}
Well, like you said, it's supposed to output a message, which is not the case. Nothing happens at all, nothing shows up... like NOTHING. After I close the console and recompile, forget it, my .exe has disapeared and it gives me the permission denied error... This is really weird...
Anyway... I hope you will be patient with my problems ...
Last edited on
Are you trying to run the program via the .exe or through the ide? Because you must build/compile it before the .exe is even updated AFAIK and it's best to just build then run the program via the IDE for testing. Otherwise you have to minimize the ide find the .exe then go back and maximize the ide.
Yup, everything I do is in the Ide.
Well, like you said, it's supposed to output a message, which is not the case. Nothing happens at all, nothing shows up... like NOTHING.


Sounds like an infinite loop/recursion that should not be happening.

After I close the console and recompile, forget it, my .exe has disapeared and it gives me the permission denied error... This is really weird...

Check the path your IDE saves the exe file in. Change the path to the desktop, so you know for sure there are no security problems.
I've created a new project which the path is the desktop.. I've clicked compiled&runned, the the console openned(without the code working) After, I closed the IDE, re openned, tried compiling&running, the console openned (Without the code working.)

But at the third time doing it, the .exe disappeared and it gave me the error. This is not normal, how can something like this happened suddenly ? Thanks for your help.
OH MY FWKKKK... sorry, I know what my f... problem was.
FOR SURE, IVE CLICKED ON SOMETHING, FOR SURE.

Do you know what the build target is ? I don't know what it does, but i've put it on debug, which I think was the cause of my problem. Without really thinking it would do anything, I've changed it to release. Guess what ? I've compiled and ran my code, and everything happened like it should ! VOILA !

One of my errors ^^ By the way, thanks everyone for your patience with my problem, I really appreciate it ! I was on many forums to find a solution and your the one which gave me the most help !
The release version is what it sounds like, a compiled program that you would release to the public. Release versions do not have debug information in the program, so reverse-engineering your executables would become tougher.

Your problem is still strange in that the file would move from Debug/bin to Release/bin when recompiling and would cause access violation. Unless you meant you changed the build target before recompiling.
That's exactly what I did, I've changed it to release before compiling and it worked. When I put it on debug and compile, permission denied error. So, if you were in my boots, what would you do ? Should I 'investigate' further, or is my problem considered solved ? Thanks !
Take a breather for now. Keep the issue in your mind and investigate further when you have the time. For now, you'll probably only have problems with debugging.
I wouldn't consider the problem solved, because you discovered a work-around and not the solution.

Hopefully one of the C++ gurus will swoop down into this thread and provide reason as to what is going on.
Yeah, okay. Anyway, I'm just learning and I don't have any projects in my head. Just want to be able to make my things work, so, the problem going away for the moment can help me continue to learn more about c++. Thanks for your help, if there's any problem, I'll come on this forum :)
By the way, you're right. When it's any other code, under the debug (build target), it works perfectly. When it's MY code, that's when the whole sh. comes in. I suspect that maybe my code was the reason to all this mess ? Who knows...
I say just get a newer version of the ide you are using or even just a newer version compiler. Codeblocks is a pretty nice IDE imo. Some people like to use pretty text editors like sublime text 2 or 3.
Pages: 123