C++ generated code doesn't seperate source and header files
Author: bigerlCreated Dec 7, 2018Updated Sep 12, 2026
The generated code for C++ puts source and header files in the same directory. It would be desirable to have seperate src and include folder. This is required to share only the public interface (in the headers) with other targets that include the compiled generated source as a library. Those should only be able to link against symbols defined in the .h files but not in the .cpp files. To achieve this currently the only way is to move the headers into a separate directory manually as the compiler is given a directory of headers instead of single files. I am using Release Tag 4.7.1.
Source: antlr/antlr4