I am running Windows Vista Home Premium and have not been able to get MinGW working with command prompt yet. I think I am pretty close though. Currently when I make a simple C program to run and compile using: gcc -Wall -o main main.c
I will get the comiler error: ld: cannot open output file main.exe: Permission denied
I believe this would be the correct place to post this question, if not feel free to move it.
Thanks a lot, if I can get this to work on my laptop it would save me going to the computer lab to do all my assignments.
What is your working directory? Is it within your MyFiles?
Ahh, that would make sense, I moved it to a folder in my documents, now I get that Windows cannot open the file main.c (but I have permission at least) and it wants to know what program I want to use to open it. However, there are no compiler issues now from what I can tell. I thought just using jedit and command prompt I could directly run the program using command prompt?
Originally Posted by CornedBee
My program is really simple right now as I'm just trying to test to see if it works on my computer.
Thanks for the help so far.
int main(int argc, char **argv)
Run the compiler as administrator or be sure to try to compile inside "my documents."
Vista restricts access to many directories due to you automatically being a normal user unless a program elevates using UAC. Otherwise you could just disable UAC itself. It does more harm than good.
Compiling code anywhere but in your home is just stupid. Running a compiler as an admin is also stupid.
UAC is idiotic, but the idea behind it is sound, so don't disable it.
Everyone has the right to compile and save code everywhere, but Vista restricts that. Running the compiler as admin isn't stupid - for legacy programs it is required. And unfortunately, even more, Microsoft and their stupid API makes it a headache for programmers to use UAC.
UAC is idiotic and causes more problems than it solves, so I would recommend disabling it. Using proper AV software, anti-spyware and common sense worked well in XP and will do in Vista too. My opinion, of course.
I chose notepad to be the program to open it up with and now whenever I run the program from the command line (it compiles without problems now) my program code will just open up in notepad. How would I get it to run like a normal program in command prompt where the output appears in the command prompt window?
Originally Posted by Adrian
You mean for legacy compilers it is required?
Originally Posted by Elysia
Wait, what opens in Notepad? The source code? What does that have to do with running the final program?
After compiling main.c on the command line in command prompt everything is fine. Then I type in main.c and the program opens up in Notepad.
Originally Posted by CornedBee
Edit: Probably because I'm putting in the .c at the end, I'm going to just type in main
Edit Again: Works now, wow, I can't believe I actually got it working on Vista. Thanks for the help everybody.
For any program that doesn't support UAC. And that probably includes typical applications such as Dev-cpp which wasn't designed for Vista in mind.
Originally Posted by robwhit
Otherwise you need to run from a folder like my documents or you'll get permission denied.