how to compile all files in a given directory with mingw-w64 (Debian[kali Linux])

279 Views Asked by At

I am following a textbook guide and the guy uses the following command on a directory using mingw32 and a Kali Linux system

 i586-mingw32msvc-c++ Hyperion-1.0/Src/Crypter/*.cpp -o hyperion.exe

i am using mingw-w64 with the same system and tried the following command

x86_64-w64-mingw32-gcc Hyperion-2.3.1/Src/Crypter/*.cpp -o hyperion.exe

and gets the following error

cc1plus: fatal error: Hyperion-2.3.1/Src/Crypter/*.cpp: No such file or directory compilation terminated.

i tried looking for answers in existing forums but the only ones that talked about it where on windows.

2

There are 2 best solutions below

1
Noam On

so i fixed it first of all i tried making a exe file out of this dir using mingw-64w in the text book the guy used .cpp but since i had a newer version of the project it was fully written in .c so that had to change, then i got another error in compilation that some .h file is missing so i went to the devs repo and downloaded the project from their insted of their website and it worked once i used:

x86_64-w64-mingw32-gcc hyperion-kali-master/Src/Crypter/*.c -o hyperion.exe

0
Brecht Sanders On

Normally one would expect some build system to be used (Autoconf+Make, CMake, Meson), but if not you can do it like this from the shell:

for F in Hyperion-2.3.1/Src/Crypter/*.cpp; do
 echo CXX $F
 x86_64-w64-mingw32-gcc $F -o $F.o || break
done
x86_64-w64-mingw32-gcc -o hyperion.exe Hyperion-2.3.1/Src/Crypter/*.o