Answer the question
In order to leave comments, you need to log in
How to arrange h and cpp files?
There is a project in which I want to use third-party libraries. They are in subfolders name1 for .h and name2 for .c. What should be done to use functions from header files if they are declared in .c files?
Answer the question
In order to leave comments, you need to log in
What should be done to use functions from header files if they are declared in .c files?
*.c files can be included in the same way as *.h,
but it is HIGHLY NOT RECOMMENDED to do this, because cyclic dependencies may arise and the compiler will swear at you for a long time :)
It is not for nothing that they came up with a division into implementation and declaration. Functions that are declared in *.c files are not public functions, but like protected/private functions in C++ classes. You can get access to them, but it's very easy to step on a rake :)
If you can't edit the library, then as an option, you can move the implementation of the functions you need into a separate module and include it in your project.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question