Include a. c file inside a project. c

Asked

Viewed 67 times

4

I am developing a simple program to deliver at the end of the first semester and would like to know if it is possible to create a main project and make the menu in one menu.c separate. Then include the menu.c within the main project?

Example:

#include <stdio.h>

int main () {

  /* Esse é o projeto principal que esta salvo como projeto.c
     e queria incluir aqui o menu.c */


   return(0);
}

Then I want to save menu.c and include it within the projeto.c above.

  • If you add more details of what you are doing, I improve the answer. Like what was posted, I can’t answer more than this.

  • All right, you’ve helped me enough. I haven’t done much yet, but what I’m thinking of doing is a simple HR program, where it stores all the employee information and so on. What I wanted to do is a main archive. c , a menu. c and a loginsenha. c to separate everything and maybe try to leave more organized...

1 answer

5


To do what you want just put one #include "menu.c" where you want to include, but I doubt that’s what you really need.

The correct solution is to compile the two files, one called the functions of the other. This can be done from the command line or by adding all the files in the project managed by the IDE.

  • Thank you, about your answer I found a link here that may help more people before the reasoning that you gave me. Follow the link: http://www.hardware.com.br/comunidade/arquivo-funcao/988264/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.