11
votes

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.

3

3 Answers

12
votes

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.

1
votes

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.

0
votes

I recently saw this and waited over 15 minutes as well... the key to me was noticing that the "Building" circle with arrows on it was still orbiting, so I thought I would give it some time... and it finally moved on:

enter image description here