This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC: limitation with the command line length
- From: Jens Schweikhardt <schweikh at schweikhardt dot net>
- To: Neatsoul <neatsoul33 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 5 Jan 2009 12:28:55 +0100
- Subject: Re: GCC: limitation with the command line length
- References: <c379d1ee0901050204m41aa73b5oc43f896f9fb882ba@mail.gmail.com> <c379d1ee0901050209w267cba6t619568bfd4971684@mail.gmail.com>
On Mon, Jan 05, 2009 at 11:09:26AM +0100, Neatsoul wrote:
# Hello everybody,
#
# I would like to compile on a windows platform, an application with
# several hundred C/C++ files but the command line is so long that GCC
# doesn't work.
Please understand that GCC *would* work. This is a limitation of
the windows shell.
# So I tried to use the "@" option of GCC in cmd.exe but it doesn't seem
# to work. Gcc return the "@file.c: No such file or directory" error so
# i deduce that the @ option is not recognized.
Right, GCC does not interpret @ the way other programs do.
# I read on the web that cygwin batch doesn't have limitation for the
# length of the command line. I tried to use the cygwin's GCC in a
# cygwin environment and this time the "@" option is enable but i have a
# limitation when a file exceed 4023 Ko.
What unit is a "Ko"?
# All the answer I found on the web wasn't enough clear for me.
#
# I would like to know if it's possible to use gcc in my case in a
# windows platform without using cygwin ? Is it possible to use the "@"
# option in cmd.exe without cygwin ?
I'm not a windows expert. However the general approach to
dealing with huge amounts of files to compile and link is:
1. Compile each file separately, as with
gcc [options] -c main.c
gcc [options] -c file1.c
gcc [options] -c file2.c
...
gcc [options] -c file1000.c
Now you have the object files main.o file1.o file2.o ... file1000.o
You can either try linking with
gcc -o executable *.o
in the hope that this is still is within the limits of your windows
shell.
2. If not, create a library from the object files, one by one. Then link
with that library.
ar -r libfoobar.a file1.o
ar -r libfoobar.a file2.o
...
ar -r libfoobar.a file1000.o
gcc -o executable main.o libfoobar.a
You get the idea?
Regards,
Jens
--
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)