zig icon indicating copy to clipboard operation
zig copied to clipboard

zig cc -c can only handle one file argument

Open hoanga opened this issue 5 years ago • 2 comments

zig cc -c handles only one file argument.

gcc and clang both compile and generate object files for each respective file argument given.

also note that zig cc -c handles multiple file arguments differently depending on platform. i.e. on Linux it will only compile the first argument given. On Mac it returns the following type of error message

error: macho does not support linking multiple objects into one

Example gcc run

$ gcc -c c1.c c2.c 
$ ls
c1.c  c1.o  c2.c  c2.o 

Example zig cc run

$ zig cc -c c1.c c2.c 
$ ls 
c1.c  c1.o  c2.c 

hoanga avatar Dec 25 '20 14:12 hoanga

same problem here

RodrigoDornelles avatar Jul 27 '22 14:07 RodrigoDornelles

Note: This can sometimes surface in e.g. CMake projects if spurious flags like /EHsc /guard:cf end up on the zig cxx command line by accident.

emidoots avatar Oct 27 '23 18:10 emidoots