I want to move some of my functions to another file because my main file is getting too large. I’ve been told to use the project explorer to add a file to my project but there has to be more to it than that. There has to be a systematic way of doing this. All I need to know is how. Do I need a header file? Do I need to use the extern keyword? Do I need an #include. Where should it be inserted if so?
Cut the function I wanted in a separate file from the main file and pasted it into the small file.
Created a header file with the function prototypes for both the big and small files.
Inserted an #include “header.h” into both the big and small files.
Tried to compile project. I then get an error saying “Undefined (but used) global label myFunction” where myFunction is the name of the function I moved to the small file.
Does anybody have a clue as to what I’m doing wrong? I’ve looked for an example in the sample directory but can’t find anything that uses multiple files. Would someone please help. Maybe post a very small example of something that works.
I found I had to add paths containing header files to the include paths via: Options > Project Options > Include Path tab (or manually by adding them to the Includes= line of the .dcp file).