Is there any problems connected with this idea
Yes. A file can compile successfully even if it has missing include files, so this can have false positives, and may remove headers that are actually used.
It is quite a difficult task to analyse which headers should be included, and which are unnecessary, both manually and automatically. Tools have been made to do the checking automatically. Even if "number of false positives is too big", it's still (in my experience) a small fraction of all included headers, so it is far less work to check results of such tool than compare includes of every file to the entire content of those files. Even the script that you suggest can be better than nothing, as long as you don't remove the includes without manual checking.
It helps manual checking to make the files as small as possible. As a side-effect, this also makes incremental compilation much faster (but compilation form scratch slower).