Page 1 of 1
cannot use some args compiling at my WindowsXP cmd
Posted: Tue Sep 19, 2006 4:40 am
by digo_rp
guys anyone knows what can I do to compile my O.S using something like that:
gcc -Wall -O3 -fstrength-reduce -ffreestanding -nostdlib -nostartfiles -fomit-frame-pointer -nostdinc -fno-builtin -c -o %2 %1
the windows prompt returns something like " cannot execute program "
is in portuguese that error forgive my english mistakes please.
maybe is something like cmdargs length
Posted: Tue Sep 19, 2006 5:47 am
by Legend
You specify -c, only compile, but not link, if I remember correctly. The result is an object file, not an executable?
Posted: Tue Sep 26, 2006 1:58 pm
by jzgriffin
If you're still looking for help, I might be able to offer some:
DOS (cmd/command) has a limit on command lengths. 127 characters is the max length. It will give you a "The system cannot execute the specified program." notice if you try to use a command longer than 127 characters. There is, however, a workaround to this. You may execute commands longer than 127 characters through a third-party program, such as make.
Here's one of my earlier workarounds:
Code: Select all
build.c
#include <stdio.h>
#include <stdlib.h>
void do_command(char *command)
{
printf("%s\n", command);
system(command);
}
int main(int argc, char* argv[])
{
do_command("build_command1");
do_command("build_command2");
do_command("etc");
/*
* Pauses so that the person building the program
* may read errors/warnings before termination.
*/
getchar();
return 0;
}
Add as many do_command("command");s as you need. Just be sure to put them before getchar();.
Compile with: gcc build.c -o build.exe
Hope this helped
Posted: Tue Sep 26, 2006 6:14 pm
by carbonBased
Jeremiah Griffin wrote:
DOS (cmd/command) has a limit on command lengths. 127 characters is the max length.
I believe this limit is larger on Win2k/Xp systems... regardless, though, there is also a limit when executing through external programs, such as make, as suggested.
This limit is substantially larger, so you're unlikely to hit it as easily, but I just wanted to toss this out, as I've reached it in the past and was a bit boggled by it at the time.
--Jeff
Posted: Tue Sep 26, 2006 11:59 pm
by jzgriffin
I'm running on XP Pro SP 2, and it doesn't accept commands longer than 127 characters. Did you paste the command in Notepad to see if the length was >= 127?