cannot use some args compiling at my WindowsXP cmd

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

cannot use some args compiling at my WindowsXP cmd

Post 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
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Post by Legend »

You specify -c, only compile, but not link, if I remember correctly. The result is an object file, not an executable?
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post 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 :-)
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post 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
jzgriffin
Member
Member
Posts: 190
Joined: Tue Sep 26, 2006 1:40 pm
Libera.chat IRC: Nokurn
Location: Ontario, CA, USA
Contact:

Post 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?
Post Reply