'Adding a source file(that contains global variables and functions) to main file without creating a header for it?(for code clarity)

I'm trying to build an embedded C program and got to a point where it contains more than a 1000 lines and growing in ESP IDF using CMAKE which makes the code hard to read and debug because of all the scrolling so I'm trying to split it into more files like my_funcs.c that will include global structs(variables) and function that I want to access from main without creating a header file for it my_funcs.h since the the values of the variables there should not duplicate (from #include from file to file)

So the question is: is making such code extensions and split possible? if so how'd you do that with CMAKE? if not how do professional programmers confront with such cases when code gets so long?

I Could start making header files for the source files and work more with pointers but this seem way harder than it can and should be and still doesn't solve the problem of saving the config_t structs separately from main.c

c


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source