How can I improve compilation time for C++ targets?

Compilation takes a lot of time and sometimes it says: Build halted by error.

After that problem, It is usual that it works fine only trying again. This is only for the first compilation. The following compilations are faster but they take a few seconds anyway.

So I think that maybe my computer has a bottleneck someplace.

My computer is

CPU: Core i7 @ 2.67
Ram: 6gb
Disk 1: SSD Samsung 1tb (Libraries and sdks are here)
Disk 2: Western Digital Black 2tb (Projects are here)

Is there something I can do to improve these?

Have you tried the compilation server?

You can also profile what’s taking most of the time using the --times flag.

Maybe you could try ccache?

https://ccache.samba.org/