Hi Zhen,
I am not quite sure if I understand your situation correctly. I agree, because you choose to don't use bmake but Visual Studio nmake, such question should be posted to StackOverflow or similar web, not here. But more important is to know how you created the project (using VS tools only?), so the problem can be investigated.
[quote user="Zhen Li"]A pure C++ project can be easily set by disable C++ optimization. [/quote]
In my opinion this is not correct (or even wrong) from two reasons:
- To produce exe/dll ready to be debugged is more complex process that includes different settings, which all together ensures it will be possible (and easy in the best case) to debug the application. At first you have to tell both compiler and linker to produce program database (PDB) file, which can be done using proper switches. Usually the optimization is switched off also, but not always.
- To switch on/off anything is wrong approach. Regardless if Visual Studio nmake or Bentley bmake is used, there should be (at least) two configurations available (Debug / Release) so to produce two different results is about to change just one setting. Visual Studio projects offer these two configuration by default, so it's only about to change settings in Visual Studio.
[quote user="Zhen Li"]The local variables (int or bool) are shown undefined while I am running debug mode.[/quote]
Is PDB file created for your dll file and is in the same folder and accessible for Visual Studio debugger?
You should also be aware that local variables are removed from stack as soon as possible, so often they don't exist anymore immediately they are used.
[quote user="Zhen Li"]I guess something should be set in the MAKE script. [/quote]
It's hard to say if we don't know how you make file looks like.
[quote user="Zhen Li"]Anybody knows how to resolve this problem?[/quote]
If you choose to use Visual Studio tools and not bmake, I guess the best way is to check how other C++ projects created by Visual Studio
looks like and to compare all compiler and linker parameters used in Debug and Release configurations. How compiler and linker is called can be checked easily, because they are stored in normal text files I guess in Win32Project1.tlog subfolder in Debug and Release folders.
With regards,
Jan