Check out some related questions: https://vi.stackexchange.com/search?q=%5Bfiletype-c%2B%2B%5D+g%2B%2B, https://vi.stackexchange.com/search?q=%5Bfiletype-c%2B%2B%5D+compile
A short answer: prefer to use :make to build and probably :terminal or :! to run the program, all of which you can bind maps to.
But if you insist on this particular setup: :help cmdline-...
For me, the problem was that my .conf file was in a file path that vim's filetype.vim did not expect. I was able to get automatic syntax highlighting to work in vim 80 by editing the filetype.vim file in the following way.
sudo vi /usr/share/vim/vim80/filetype.vim
Find a line that ends with setf apache.
" Apache config file
au BufNewFile,BufRead ....