问题
When I build a c++ project with Visual Studio the process get in stuck while Generating Code:
1>------ Rebuild All started: Project: myWrapper, Configuration: Release Win32 ------
1> funzioni_ausiliarie.cpp
1> myWrapperFunction.cpp
1> NLP_eta_tre_spline.cpp
1> Generating Code...
MSVS is still responding and seems to being working, but I waited more than 10 minutes and it didn't finished. Finally I canceled the process. Instead, building in debug mode it finisces in 20 seconds.
I also tried to disable "Whole Program Optimization" and "Multi-processor compilation" in C++ compile options and I left empty the parameter "Link Time Code Generation" in linker options (obviously for release configuration) but the problem still occurs.
Any help would be greately appreciated.
回答1:
I applied this http://www.gamedev.net/topic/627047-visual-studio-generating-code-infinitely/. That is: in prject properties, setting the C++ -> Optimization -> Optimization to "Disable".
Now it works properly. I also setted to original values "Whole Program Optimization", "Multi-processor compilation" and "Link Time Code Generation" and it works.
回答2:
With VS2017 (15.5.0), I ran into a problem where building a third-party library for Release hung the compiler at "Generating Code" for tens of minutes, and I gave up waiting. I had been using Whole Program Optimization, but turning that off didn't help.
I also had been using Optimization set to Maximum Speed (/O2). I changed it to Custom and turned on /Ob2, /Oi, /Os, and /Oy. The build completed in a few seconds. For the library I was using, that was good enough.
来源:https://stackoverflow.com/questions/27862353/visual-studio-in-stuck-generating-code