My project currently takes 16 minutes to compile.
Is there anyway that I can reduce the compilation time significantly?
Optimize all your functions and maybe use as much dynamically created variables etc as possible. Sorry dont know other then maybe upgrade your computer hardware(maybe over clock your cpu).
Ok -- First off a little help with how big / and how much cpu you have available [and memory] would have helped. OS and compiler would be useful information.
however, if you get to 16minutes on anything remotely modern and anything remotely
under 250,000 lines of total code + comments you are likely making serious errors.
I will assume that your are using a Makefile with reasonable dependencies etc, if you are compiling your whole project each time, please please read about Makefile
First off: disentangle your include list. The biggest problem with c++ projects is that everyone seems to want to put #include's in .h files. Don't do it. It is MUCH better to see the list in the c++ file. Even if it is long -- It is easier to follow if you are looking for what is dependent and it is easier to see what has become bloated.
Second: Move stuff out of the .h files. If the code for a method is in the .h file (i.e. the class definition) it is going to be compiled each time the .h file is included in a file. That means template classes as well.
Third: Use explicit template instantiation. This is obviously not going to work if the product is a library, but will work if the product is an application since you have final control. That cuts a HUGE chunk off the compile time using g++.
Four: Now have a look and start putting pre-declarations e.g. class A; and removing the actual includes. For example you don't need to include a full class definition for any pointer or reference which is only part of a .h definition [You do if you use the pointer/reference in the definition part of a class.]
Five: If you are using visual C++ : Sorry it is slow. Use something else. If you are using cygwin/g++ that is REALLY slow. It it is a Qt project, then you may have issues with moc being a little slow. I am guessing as to your likely problem.
If your project contains lots of *.c and/or *.cpp files with lots of includes that are common among all of them then using precompiled headers will help speed up the compile process. How to do that, if it can be done at all, will depend on the compiler you are using.
But 16 minutes isn't really so bad -- in 1985 I used to start a program compiling then go read a book or do something else for two hours.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...