1

Estoy aprendiendo C, anteriormente comencé a escribir líneas de código sencillas y compilando a través de VSCode con el compilador Mingw sin problema alguno, por cuestiones de optimización tuve que formatear y reinstalar mi sistema operativo y estoy intentando volver a correr el código que ya tenia hecho desde el cmd, pero con cada archivo me aparece el mismo extenso error:

C:\Users\Eri\Documents>gcc main.c -o main.exe

C:\Users\Eri\Documents>gcc main.exe
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x2a0): multiple definition of `_mingw32_init
_mainargs'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2a0): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x2e0): multiple definition of `mainCRTStartu
p'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2e0): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x300): multiple definition of `WinMainCRTSta
rtup'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x300): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x320): multiple definition of `atexit'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x320): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x330): multiple definition of `_onexit'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x330): first defin
ed here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x340): multiple definition of `__gcc_registe
r_frame'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x0):
 first defined here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.text+0x430): multiple definition of `__gcc_deregis
ter_frame'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0xf0)
: first defined here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.bss+0x4): multiple definition of `_argc'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.bss+0x4): first defined
here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.bss+0x0): multiple definition of `_argv'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.bss+0x0): first defined
here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Erro
r: Could not find abbrev number 84.
main.exe:cygming-crtbegin.c:(.eh_frame+0xb8): multiple definition of `__EH_FRAME
_BEGIN__'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.eh_frame+0
x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x92)
: undefined reference to `_Jv_RegisterClasses'
collect2.exe: error: ld devolvi¾ el estado de salida 1

Por otro lado este es el código del archivo main.c:

#include <stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

No sé si se deberá a algún paquete que me haya faltado instalar, aunque he revisado en distintos tutoriales de instalación. Acá dejaré una captura de lo paquetes básicos de mingw que instalé:

Captura de pantalla de mingw

Muchísimas gracias de antemano por cualquier ayuda. Saludos

0

1 respuesta 1

4

SOLUCIÓN

Se trata de un simple error de comandos en CMD, para hacer la ejecución de un archivo ya compilado no hace falta llamar al compilador (gcc) simplemente se ejecuta el archivo .exe, esto era lo que me estaba causando el error. He aquí las instrucciones correctas:

C:\Users\Eri\Documents\Proyectos\C>gcc hola.c -o d.exe

C:\Users\Eri\Documents\Proyectos\C>d.exe
 Hello World

Se trata de una novatada sin embargo dejo este post colgado por si a otro aprendiz le ocurre el mismo problema y no encuentra solución. Saludos.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.