Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW GCC in Windows 7 x64 does not create an executable

Tags:

c

windows

gcc

mingw

I'm having a similar, or possibly the same issue as a few others I have seen, but I am not sure. I am using mingw's copy of gcc directly from the windows command prompt on files in my personal directory, and I have edited the PATH to include C:\MinGW\bin

The following:

gcc -o print print.c

Grants me no output file, or so I thought. I opened up a file browser and sat there while gcc ran, and saw the file appear, and shortly after gcc finished, disappear. I receive no error.

Just running

gcc print.c

yields nothing as well as

mingw32-gcc print.c

Here is my PATH (Cleaned up to fit my screen better):

C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Broadcom\Broadcom802.11;C:\Program Files\Broadcom\Broadcom 802.11\Driver;
C:\Program Files (x86)\QuickTime\QTSystem\;C:\MinGW\bin

This happens with multiple source files, but here is the source of the one I am working on in case you think that might be the issue:

#include <stdio.h>
int main(void) {
    for (;;) {
        int i;
        i = 0;
        int num;

        printf("Please enter a number:\n");
        scanf("%d", &num);
        printf("\n");

        if (num <= 0) {
            return 0;
        }

        while (i <= num) {
            printf("%d\n", i);
            i++;
        }
    }
}

Yes, I know it is really simple, I am just getting started on learning C.

Any ideas?

I'm downloading Code::Blocks right now, and will update if I find out that it works correctly there.

Edit: Requested output ahead

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=m
ingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto
--enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++
,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-l
ibstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --
with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-
libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/
mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
 c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1.exe -quiet -v -iprefix c:\mingw\b
in\../lib/gcc/mingw32/4.8.1/ print.c -quiet -dumpbase print.c -mtune=generic -ma
rch=pentiumpro -auxbase print -version -o C:\Users\kyle\AppData\Local\Temp\ccBlz
Ym1.s
GNU C (GCC) version 4.8.1 (mingw32)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/inclu
de"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../..
/../../include"
ignoring duplicate directory "/mingw/include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/inclu
de-fixed"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../..
/../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../include
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include-fixed
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../mingw32/include
End of search list.
GNU C (GCC) version 4.8.1 (mingw32)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 767202a405449496e68a54c4eee91a28
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
 c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/as.exe -v -o C:\U
sers\kyle\AppData\Local\Temp\cc3cEZAy.o C:\Users\kyle\AppData\Local\Temp\ccBlzYm
1.s
GNU assembler version 2.24 (mingw32) using BFD version (GNU Binutils) 2.24
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/;c:/mingw/bin/../libexec
/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.8.1/;c:/mingw/bin/../lib/gcc/;c:/
mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/;c:/mingw/bin/../lib/
gcc/mingw32/4.8.1/../../../
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
 c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/collect2.exe -Bdynamic c:/mingw/bin/.
./lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/crt2.o c:/mingw/bin/../lib/gcc/m
ingw32/4.8.1/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1 -Lc:/mingw/bin/.
./lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib -Lc:/m
ingw/bin/../lib/gcc/mingw32/4.8.1/../../.. C:\Users\kyle\AppData\Local\Temp\cc3c
EZAy.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell
32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt c:
/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.o

Edit: I get the same issue in Code::Blocks.

like image 530
Cèilidh Nevling Avatar asked Aug 14 '14 00:08

Cèilidh Nevling


People also ask

Where is mingw32 EXE?

In your installation folder, inside the bin directory, you should find a file called mingw32-make.exe.

What is the difference between MinGW and MinGW64?

MinGW-w64 is a improved version which supports both 32bit and 64bit, and some more of the WinAPI (still not all, because thats much work, but more than MinGW). MinGW-w64 only provides their source code, but no binaries to "just use" the compiler.


1 Answers

I had similar issue where no output files were created.

The following packages were installed at the time : mingw-developer-toolkit, mingw32-gcc-g++, msys-base

To resolve the problem, i installed mingw32-base

like image 120
user1996617 Avatar answered Sep 27 '22 23:09

user1996617