I have 2 source files: test.cpp and func.cpp
and 1 header file: func.h
Contents of these files are as follows:
1. test.cpp
#include "func.h"
int main() {
...
func();
...
}
2. func.cpp
#include "func.h"
void func() {
//func() definition
}
=====================
func.h
=====================
#include <iostream>
using namespace std;
void func(); /* func() declaration */
=====================
Problem:
Problem is to find out the source file name which contains definition of undefined entities in header files.
For the example mentioned above: I need to find out source file which contains definition of function "func()
".
Approaches taken but no required result found:
I tried using "makedepend
" and "gcc -MM <source file names>
" to get the source files which contains definition of undefined entities in header files, but it just gave a rule, showing the header files which are included directly or indirectly by the source files.
Output of gcc -M test.cpp func.cpp
is as follows:
test.o:test.cpp func.h
func.o:func.cpp func.h
I need to get an output of the form:
test.o:test.cpp func.h func.cpp
Can anyone please, let me know the way of solving this problem. How to get the source file name which provides me definition of undefined entities in included header file Thanks in advance.