-3

As the title implies, I have a code file in C language and a Header file with its implemantation. What should I write in the command line on an oparating Linux-like system in order to make an executable programme?

RandomUser
  • 27
  • 2
  • 1
    You do not compile headers, and header files typically do not contain "a code file's implementation" as you say. This question makes very little sense. – unwind Mar 09 '17 at 21:56
  • The program you (probably) want is called `gcc`. Google will tell you more. – HolyBlackCat Mar 09 '17 at 21:56
  • Thank you very much – RandomUser Mar 09 '17 at 21:58
  • The subject line of your question has no relationship to the body – KevinDTimm Mar 09 '17 at 22:04
  • Welcome to Stack Overflow. Please read the [About] and [Ask] pages soon, but even more importantly, please read about how to create an MCVE ([MCVE]). At least, you should specify the two file names — `codefile.c` and `header.h` would be better than nothing — and confirm that `codefile.c` contains a line `#include "header.h"`. Even without any makefile, typing `make codefile` would compile `codefile.c` to create an executable `codefile`; you could also type `gcc -Wall -Wextra -Werror -o codefile codefile.c`. If it doesn't compile, you should include error messages in an edit of the question. – Jonathan Leffler Mar 09 '17 at 23:24

3 Answers3

2
gcc file.c -o yourProgram
./yourProgram
DZDomi
  • 1,685
  • 15
  • 13
-1

A shell script running gcc on all the .c files you with to compile.

The bug advantage of make is that correctly written, it will only compile changed files saving you on build times especially during development

doron
  • 27,972
  • 12
  • 65
  • 103
-1

First you need to look at what compilers (if any) are installed with your system (which gcc). Assuming you have gcc, look at this question which should provide an answer:

How to compile a C program in gcc which has header files?

note that gcc CodeFile.c -o ExecutableName is a basic command to compile a basic executable from the .c itself.

Or, make your #include statements use relative paths, depending on how your code base is structured.

Community
  • 1
  • 1