Splitting a big file into smaller files

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?


Here’s what I’ve done so far.

Created a project file.

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.


Hi Tom,

I am using Dynamic C 10.64.

May be you forgot to include function definition(myFunction).

If you send code , then i can find where is the problem.

For your understanding i am giving one example , try to do like this.

Create main.c ,1.c , 2.c , header.h files to your project.

  1. In header.h file declare function prototypes like
    void fun1();
    void fun2();

  2. In main.c file write main program like this
    #include “header.h”
    void main()

    printf("Main function


  3. In 1.c file write like this
    #include “header.h”

    void fun1()

  4. In 2.c file write like this
    #include “header.h”

    void fun2()

Then save the project, compile and run then it will work properly.


Hi Tom and Cpigilam,

did you resolve this issue?

I am struggling with the same problem using DC 10.66.

Tor Erik

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).