There is an error when using overly long commands in
some windows versions (seen on win98, not seen on winXP).
The linker line was overly long, and the error after
the linking was :
Bad command or filename
Execution Terminated
Compilation Successful
This is extremely misleading and no executable is
generated. The compilation is successful with a
shorter linking command (achieved by putting the dev
file closer to the .c/.o files to reduce path components).
DevCpp should check the max command line length and
warn the user when it is too long.
EXAMPLE:
Compiler: Default compiler
Building Makefile: "C:\Mina dokument\Makefile.win"
Executing make clean
...
compilations...
...normal compilation up to here, the linker line was
the problem.
...
gcc.exe -DDEBUG
../cygwin/home/admin/daimonin/client/src/zutil.o
../cygwin/home/admin/daimonin/client/src/client.o
../cygwin/home/admin/daimonin/client/src/commands.o
../cygwin/home/admin/daimonin/client/src/crc32.o
../cygwin/home/admin/daimonin/client/src/dialog.o
../cygwin/home/admin/daimonin/client/src/event.o
../cygwin/home/admin/daimonin/client/src/inffast.o
../cygwin/home/admin/daimonin/client/src/inflate.o
../cygwin/home/admin/daimonin/client/src/inftrees.o
../cygwin/home/admin/daimonin/client/src/inventory.o
../cygwin/home/admin/daimonin/client/src/item.o
../cygwin/home/admin/daimonin/client/src/main.o
../cygwin/home/admin/daimonin/client/src/menu.o
../cygwin/home/admin/daimonin/client/src/misc.o
../cygwin/home/admin/daimonin/client/src/player.o
../cygwin/home/admin/daimonin/client/src/socket.o
../cygwin/home/admin/daimonin/client/src/sound.o
../cygwin/home/admin/daimonin/client/src/sprite.o
../cygwin/home/admin/daimonin/client/src/textwin.o
../cygwin/home/admin/daimonin/client/src/uncompr.o
../cygwin/home/admin/daimonin/client/src/wrapper.o
../cygwin/home/admin/daimonin/client/src/adler32.o
../cygwin/home/admin/daimonin/client/src/map.o -o
"Project1.exe" -L"C:/DEV-CPP/lib" -mwindows -lmingw32
-lSDLmain -lSDL -lSDL_image -lwsock32
Felaktigt kommando eller filnamn. (translation fro
Swedish: bad command or filename)
Execution terminated
Compilation successful
Logged In: YES
user_id=609236
that's a known problem. depending on sources windows has
2000 char limit in command line. if you can point to the
solution I'll take care of that (using msys or other unix
shells is not an option right now).
Logged In: YES
user_id=295692
By keeping the generated object files in a reserved
directory, the link command line may use
<reserved-directory>/*.o and save a lot of command late
'estate'.
Then only manually added object files need to be explicitly
specified in the link step.
Logged In: YES
user_id=609236
reference to discussion on mingw-users:
http://sourceforge.net/mailarchive/message.php?msg_id=6915209
ld scripts seems to be the best idea
Logged In: YES
user_id=609236
so in this case ld script would be:
INPUT(
../cygwin/home/admin/daimonin/client/src/zutil.o
../cygwin/home/admin/daimonin/client/src/client.o
../cygwin/home/admin/daimonin/client/src/commands.o
../cygwin/home/admin/daimonin/client/src/crc32.o
../cygwin/home/admin/daimonin/client/src/dialog.o
../cygwin/home/admin/daimonin/client/src/event.o
../cygwin/home/admin/daimonin/client/src/inffast.o
../cygwin/home/admin/daimonin/client/src/inflate.o
../cygwin/home/admin/daimonin/client/src/inftrees.o
../cygwin/home/admin/daimonin/client/src/inventory.o
../cygwin/home/admin/daimonin/client/src/item.o
../cygwin/home/admin/daimonin/client/src/main.o
../cygwin/home/admin/daimonin/client/src/menu.o
../cygwin/home/admin/daimonin/client/src/misc.o
../cygwin/home/admin/daimonin/client/src/player.o
../cygwin/home/admin/daimonin/client/src/socket.o
../cygwin/home/admin/daimonin/client/src/sound.o
../cygwin/home/admin/daimonin/client/src/sprite.o
../cygwin/home/admin/daimonin/client/src/textwin.o
../cygwin/home/admin/daimonin/client/src/uncompr.o
../cygwin/home/admin/daimonin/client/src/wrapper.o
../cygwin/home/admin/daimonin/client/src/adler32.o
../cygwin/home/admin/daimonin/client/src/map.o
)
SEARCH_DIR(
C:/DEV-CPP/lib
)
GROUP(
-lmingw32 -lSDLmain -lSDL -lSDL_image -lwsock32
)
OUTPUT(
Project1.exe
)
and run
ld -T script.txt
I'm just not sure where should -mwindows go and if the
default script (which can be retrieved by
ld -verbose
should be included...).
This would definitely be experimental for awhile
Logged In: YES
user_id=609236
1051736 is a duplicate of this bug
Logged In: YES
user_id=1234827
I have the same problem with a project which contains a huge
number of files.
Compilation is done but linking failes because the command
line is too long.
I hope you'll be able to fix it soon.