What I am about to suggest would still require a makefile, so I am partially repeating the advice from an earlier reply. Or, as was also mentioned earlier, maybe you already have a makefile, in which case you will have even fewer steps in order to accomplish what I am about to describe.
Once you know your specific windows command-line command for invoking make or g++ on your code, then you create a "Pre-Build Event" in your Visual Studio Project. ("Project Properties >> Configuration Properties >> Build Events >> Pre-Build Event").
The pre-build event can call a bat file script, or any other script on your machine, and that script will be able to return an error-code. Essentially, "script OK," or "script FAILED" is the extent of the amount of communication your script can have BACK to visual studio.
The script doesn't automatically see all the visual studio environment variables (such as $(InputDir), $(ProjectDir), $(SolutionName), etc), however you can use those variables when you specify how to call the script. In other words, you can pass those values to the script as arguments.
Set this up so that every time you build in Visual Studio, the pre-build event will FIRST try to run make/g++ on your code. If your script (the one that calls make/g++) detects any problems, then the script returns an error and the build can be STOPPED right then and there. The script can print to stdout or stderr and that output should be visible to you in the Visual Studio Build output window (the window that usually shows stuff like "========== Build: 3 succeeded, 0 failed").
You can have the script print:
"BUILD FAILED, non-portable code detected, make/g++ returned the following:........."
This way, you don't have to remember to periodically switch from Visual Studio to the command line. It will be automatically done for you every time you build.