Compiling to an exe with mingw...

This is a discussion on Compiling to an exe with mingw... within the Tech Board forums, part of the Community Boards category; I'm confused as to how you make an exe using mingw / MYSY. Anytime I try Code: make C:\test.cpp In ...

  1. #1
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379

    Compiling to an exe with mingw...

    I'm confused as to how you make an exe using mingw / MYSY. Anytime I try
    Code:
    make C:\\test.cpp
    In mysys, it says:
    Code:
    make: Nothing to be done for `C:\Test.cpp'.
    And when I try G++ C:\\Test.cpp it waits a second, then just creates another line, it doesnt say anything, or do anything. I'm very confused .
    Last edited by Ken Fitlike; 08-26-2006 at 03:31 AM. Reason: fixed code tags
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,341
    make processes makefiles, not source code files.

    > And when I try G++ C:\\Test.cpp it waits a second,
    Yep, that's the thing to do.
    Look in the directory, you should see test.exe, which is the program just compiled and linked.

    Unlike some other chatty compilers which like to print out all sorts of guff, gcc only speaks when there is something worth saying (like an error message). If the program is good, then it compiles in silence.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    There is no test.exe in the c drive or the bin :/.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,341
    g++ c:\test.cpp
    ?
    The command line doesn't need \\ escapes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    When I try
    g++ C:\test.cpp

    I get:

    Code:
    $ g++ C:\test.cpp
    g++.exe: C:test.cpp: No such file or directory
    g++.exe: no input files
    It only works with \\
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,341
    OIC, the MSYS SHELL
    Try with forward slashes then

    Or check your directory to see where your source file is.

    Typically, output from the compiler is placed in the current directory, not the directory where the source code is.
    gcc ../prog.c
    places a.exe in my current dir
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Ahhhh! I didint realize the program would be named a.exe, that was my problem lol. Thanks salem .
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You can use the -o switch to name the output file to whatever you wish, eg
    Code:
    g++ -o test.exe test.cpp
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help compiling example code (MinGW and DirectX9)
    By scwizard in forum Game Programming
    Replies: 10
    Last Post: 07-25-2008, 10:43 AM
  2. Quincy 2005: Compiling Errors
    By Thileepan_Bala in forum C Programming
    Replies: 6
    Last Post: 01-18-2008, 07:26 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. compiling mingw to enable timeSetEvent
    By underthesun in forum Windows Programming
    Replies: 2
    Last Post: 02-02-2005, 05:00 PM
  5. Compiling Resources In MinGW
    By Okiesmokie in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 03:16 PM

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