Question

I have a batch file with this code:

@echo off
set VAR=7
echo the version is %VAR%

I want to add this .bat file to my visual studio project, using pre-build event. I wrote in the pre build event the path to the batch file, but then when I enter the : Resources ->PreProcessor definitions - I can't see the VAR How can I add it? any help would be appreciated!!

Was it helpful?

Solution

Change your BAT script to be something like

echo #define VER 7 > version.h

and then have your code use

#include "version.h"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top