Hi,
I already used more than one source file in my project for simple functions and everything compiled successfully.
Now I am trying to add another source file of a slightly more complex function.
This functions uses:
-global declared struct
-calls another function at the end
-uses a global variable int
What is the procedure step by step (header files, include's etc)to compile properly because I couldn't find anything for a slightly complicated function.
1. Make a header file for this source file.
2. Put the declarations for the applicable functions in this header file.
3. Define those functions in your source, the other source files can now use your function.
4. If you are using a function from another source file, include that source's header in your source.
5. If you use a global struct from another source file, ensure that you include that source's header
6. If you are making a global struct available for another source file, define it in your source and then declare it in your header with the extern keyword.
7. If you are using a global variable (int) from another source file, ensure that you include that source's header.
8. If you are making a global variable (int) available for another source file, define it in your source and then declare it in your header with the extern keyword.