Compiler Issues

This is a discussion on Compiler Issues within the Tech Board forums, part of the Community Boards category; I am running Windows Vista Home Premium and have not been able to get MinGW working with command prompt yet. ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    23

    Compiler Issues

    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.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    What is your working directory? Is it within your MyFiles?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    23
    Quote Originally Posted by CornedBee View Post
    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?

    My program is really simple right now as I'm just trying to test to see if it works on my computer.

    Code:
    #include <stdio.h>
    
       int main(int argc, char **argv)
       {
          printf ("Hello\n");
          return 0;
       }
    Thanks for the help so far.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,827
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,827
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Posts
    23
    Quote Originally Posted by Adrian View Post
    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?

    My program is really simple right now as I'm just trying to test to see if it works on my computer.

    Code:
    #include <stdio.h>
    
       int main(int argc, char **argv)
       {
          printf ("Hello\n");
          return 0;
       }
    Thanks for the help so far.
    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?

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by Elysia View Post
    for legacy programs it is required.
    You mean for legacy compilers it is required?

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Wait, what opens in Notepad? The source code? What does that have to do with running the final program?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    Registered User
    Join Date
    Oct 2007
    Posts
    23
    Quote Originally Posted by CornedBee View Post
    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.

    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.
    Last edited by Adrian; 01-09-2008 at 05:06 PM.

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,827
    Quote Originally Posted by robwhit View Post
    You mean for legacy compilers it is required?
    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.
    Otherwise you need to run from a folder like my documents or you'll get permission denied.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler questions
    By DvdHeijden in forum C++ Programming
    Replies: 6
    Last Post: 01-17-2005, 02:00 PM
  2. Compiler issues
    By Strix Varia in forum C++ Programming
    Replies: 3
    Last Post: 01-14-2005, 01:58 AM
  3. Have you ever written a compiler?
    By ammar in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 12-27-2004, 06:10 AM
  4. C Compiler
    By SAMSEIED in forum C Programming
    Replies: 5
    Last Post: 06-06-2002, 05:44 PM
  5. Special Compiler for win app's
    By Unregistered in forum Windows Programming
    Replies: 19
    Last Post: 04-26-2002, 03:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21