Try to compile your code normally as
gcc test.c
If you get default output file a.exe,then go for
gcc test.c -o test.exe
Try to compile your code normally as
gcc test.c
If you get default output file a.exe,then go for
gcc test.c -o test.exe
I would suggest you go through this compilation instruction :-
gcc -o test.exe test.c
I believe this code runs perfectly on your windows system.Please inform if it doesn't!
gcc - How do I compile a C/C++ program through windows command prompt? - Stack Overflow
How to compile a C program with gcc? - Stack Overflow
What is the correct way to compile c code
How to absolutely minimize the executable produced by GCC?
Videos
if you have codeblocks installed with mingw as the gcc compiler then follow these steps
- Right click on my computer -> go to properties -> advance system settings
- Then make an environment variable named PATH and paste the complete url like program file (x86)/codeblocks/mingw/bin.
- now open cmd
- go to the directory where your program is saved.
- type gcc program_name.c -o program_name.exe to compile the program.
- run the program by typing program_name
Please read Compile Programs with MinGW -- A Guide for New Users.
To make gcc produce assembler code, use -S option:
-S Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non-assembler input file specified. By default, the assembler file name for a source file is made by replacing the suffix .c, .i, etc., with .s. Input files that don't require compilation are ignored.
Good luck!
You need to run
Copygcc b.c -o b.exe
Without -o option it'll use the default output executable name which is a.exe on Windows and a.out on *nix systems. You can easily see the a.exe with the dir command
-o file
Place output in file file. This applies to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code.
If
-ois not specified, the default is to put an executable file ina.out, the object file for source.suffix insource.o, its assembler file insource.s, a precompiled header file insource.suffix.gch, and all preprocessed C source on standard output.https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html
For more information read Determining C executable name
Of course you can also run a instead of b
Compile like this
Copygcc -o b b.c
by specifying output filename
Copy-o <output_file>
I've got a program that is split into header files and c files along with the main. I was told to do gcc main.c <library.c>... for every other code but i don't remember having to do that when I've done stuff with header files in the past. How are you supposed to do this. Also are you supposed to include the headerfile in the .c version that the header is declaring the functions from? Sorry for my lack of technical terms. I'm exhausted today