Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio in stuck Generating code

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.

like image 748
Homer1982 Avatar asked Jan 09 '15 14:01

Homer1982


2 Answers

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.

like image 90
Edward Brey Avatar answered Nov 17 '22 21:11

Edward Brey


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.

like image 12
Homer1982 Avatar answered Nov 17 '22 20:11

Homer1982