`HAVE_OPENCV_GPU` is defined in `opencv_modules.hpp`. You need to include this file before you use `HAVE_OPENCV_GPU`.