you may either need to use the local variables or compile with optimisations disasbleoptimizations disabled
I assume you are using msvc on windows ??
shown below is a snippet that was compiled on x64 for x64 in win 10 where you can clearlu seetheclearly see the local vars being initialized and used
F:\src\local>ff:\git\usr\bin\ls -lg
total 1
-rw-r--r-- 1 197121 61 Sep 25 15:24 local.cpp
F:\src\local>ff:\git\usr\bin\cat *
int main (void)
{
int x = 1;
int y = 2;
return x+y;
}
F:\src\local>clcl /Zi /W4 -GS /analyze /Od /nologo local.cpp /link /release /ENTRY:main /SUBSYSTEM:windows /FIXED
local.cpp
F:\src\local>ff:\git\usr\bin\ls -lg *.exe
-rwxr-xr-x 1 197121 2560 Sep 25 15:32 local.exe
description of options given to compiler and linker
/Zi = build with debug info embedded in pdbfile
/w4 build with highest possible warning level
-GS disable stack cookie
/analyze run code analysis on the src files
/Od disable optimization
/entry:main (no crt libs are sued so you need to set the entry point
/subsystem:windows no cmd or no crt or no input output this is not a console app
so you need to specify which subsystem will this program work on
/fixed disable relocations