[Geany-Users] Help running GCC command through Geany
ataylor at xxxxx
Wed Mar 8 03:15:16 UTC 2017
First time posting to this group! I'm a lecturer at a university and I'm
interested in using Geany as the IDE for a class we run on an introduction
to the C language for freshman electrical and computer engineering
students. Is this the appropriate way to ask questions / for help? I didn't
seem to find any Geany forums...
Anyways, I'm trying to figure out how I can use Geany to build a
multiple-C-file project on a Windows machine. I have installed MinGW / GCC
on my computer and have added the directory as part of the "PATH" variable.
I can access GCC directly from the command line no problem. Geany actually
works great when compiling and running single-file programs.
I'm trying to run a Command Prompt expression I wrote which generates the
object files for every C-file in the current directory. To do this, I need
to use multiple calls to GCC using a for-loop. Afterwards, I can use a
single call to GCC to link all the object files together. No problems
The problem I'm having is this: when I try to add the CMD prompt expression
to a custom build command, Geany gives me the error "Process failed (They
system cannot find the file specified)".
The command I'm trying to run is below:
for %i in (*.c); do gcc -Wall -c -o "%~ni.o" "%i";
This works fine when I run it directly from the CMD prompt. Any reason why
this would not work through Geany's "Set Build Commands" area?
The linking command (to merge all the object files together) works fine
gcc -Wall -o "%e" *.o
Currently, I just have to click the "Compile" button separately on every C
file individually first before doing the linking command above.
Below is the computer information:
*Geany 1.29 for Windows*
*Running Windows 7, 64-bit*
The two C-files I'm trying to compile together are quite simple... see
int a = 5, b = 2;
printf("My answer is %d", myfunc(a,b));
int myfunc(int x,int y)
return 3*x - y;
Any help is greatly appreciated! Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users