JMU JMU - Department of Computer Science
Help Tools
Frequently Asked Questions about MinGW/MSYS


  1. What is the PATH?
    Most operating systems do not search the entire file system to find executables because it would take too long. The PATH is used to tell the operating system where it should look for executables. It contains a list of directories/folders.
  2. How do I change the PATH?
    This varies from OS to OS.
    1. How do I change the PATH in MS-Windows?
      In MS-Windows XP you can make global changes (either for one user or the system) to the PATH using the "Control Panel" by clicking on the System icon, selecting the Advanced tab, clicking on Environment Variables, selecting PATH (in the appropriate category) and clicking on Edit.

      From the MS-Windows shell you can make local changes (i.e., for this shell) using the set command. The easiest way to add something to the end of the PATH is with the command:

      set PATH=%PATH%;directory-to-add
    2. How do I change the PATH in MSYS?
      MSYS uses a Bourne-like shell, hence you can change the PATH using the export command. The easiest way to add something to the end of the PATH is with the command:

      export PATH=$PATH:directory-to-add

  3. When I try to use g++ from the MS-Windows shell I get an error that says something like "g++ is not recognizable as an internal or external command, operable program, or batch file". What should I do?
    First, read the answer to the question "What is the PATH?". In this case, the OS can't find the GNU Compiler Collection (GCC), so you need to add the appropriate directory to the PATH.
    1. I'm working at home, what should I do?
      You installed the GCC when you installed MinGW. See the discussion of "Working from the MS-Windows Shell" in the help page on installing MinGWClick here for information. .
    2. I'm working in one of the CS Department's labs, what should I do?
      See the discussion of "Working from the MS-Windows Shell" in the help page on using MinGW in the CS labsClick here for information. .
  4. When I try to use the make utility from the MS-Windows shell I get an error that says something like "make is not recognizable as an internal or external command, operable program, or batch file". What should I do?
    First, read the answer to the question "What is the PATH?". In this case, the OS can't find the make utility, so you need to add the appropriate directory to the PATH.
    1. I'm working at home, what should I do?
      You installed the make utility when you installed MSYS. See the discussion of "Working from the MS-Windows Shell" in the help page on installing MinGWClick here for information. .
    2. I'm working in one of the CS Department's labs, what should I do?
      See the discussion of "Working from the MS-Windows Shell" in the help page on using MinGW in the CS labsClick here for information. .
  5. When I try to compile a class in jGRASP I get an error that says something like "jGRASP wedge2 error: command g++ not found". What should I do?
    1. I'm working at home, what should I do?
      See the discussion of "Installation" in the help page on installing MinGWClick here for information. .
    2. I'm working in one of the CS Department's labs, what should I do?
      See the discussion of "Using jGrasp" in the help page on using MinGW in the CS labsClick here for information. .
  6. When I try to use make in jGRASP I get an error that says something like "jGRASP wedge2 error: command make not found". What should I do?
    1. I'm working at home, what should I do?
      See the discussion of "Installation" in the help page on installing MinGWClick here for information. .
    2. I'm working in one of the CS Department's labs, what should I do?
      See the discussion of "Using jGrasp" in the help page on using MinGW in the CS labsClick here for information. .
  7. When I run the linker I get an error that says something like "undefined reference to `WinMain@16'". What should I do?
    Every executable has to have an entry point. In C++, the entry point is a function/method named main (with appropriate parameters and return-type as discussed in lecture). This message is telling you that you do not have an appropriate main method in any of the object files that you are linking together.
  8. When I run the executable a window appears and then immediately disappears. What should I do?
    1. I'm running the executable from jGRASP and I get a message that says something like "error: command 'a.exe' does not exist.". What should I do?
      jGRASP assumes (unless you tell it otherwise by changing a setting) that the executable is named a.exe. So, you need to make sure that the output of the linker is named a.exe.
    2. I'm running the executable by clicking on it. What should I do?
      The problem is that the executable you created is a "console application", it is not a well-behaved windowing application. There are a couple of things that you can do to get around this:
      • Run the executable from a command shell.
      • Create a batch file that runs the executable and then pauses. If you want to get really fancy, you can do this using the make utility by adding an entry like the following to the top of your makefile:
                      Driver.bat: Driver.exe
                              @echo "Driver.exe && pause" > Driver.bat
        	      

Copyright 2019