# How to re-compile only file that changed using Microsoft compiler?

## Recommended Posts

I'm not sure if this is the right place for this question, but I'll give it shot

Using Visual Studio Code, I have the task.json set up to launch a batch file that is set up like follow:

@echo off
call "Z:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86

set INC_PROJECT_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1"
set INC_SDL_PATH="Z:\Dependencies\SDL2-2.0.5\SLD2"

set SOURCE1_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\source\*.cpp"
set SOURCE2_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\Engine\*.cpp"

set LIB_SDL_PATH="Z:\Dependencies\SDL2-2.0.5\lib\x86"
set OUTPUT_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\Debug\Pacman.exe"

cl /std:c++latest /W4 /ZI ^
/I %INC_SDL_PATH% /I %INC_PROJECT_PATH% ^
/EHsc %SOURCE1_PATH% %SOURCE2_PATH% ^
/LIBPATH:%LIB_SDL_PATH% SDL2main.lib SDL2.lib ^
/out:%OUTPUT_PATH%

I'm not totally sure about what it's doing and I'm piecing it togeter as I go (trial and error + google), so if I got it right, the *.cpp at the end of those paths,  it means that every time I build it will build all the .cpp that it finds in those 2 paths.

And that doesn't sounds good, so I was wondering, there is a way to tell it to re-compile only the files that have changed?

##### Share on other sites

Any particular reason your not using the IDE to compile your project?  It does this automatically.

##### Share on other sites
1 hour ago, Mike2343 said:

Any particular reason your not using the IDE to compile your project?  It does this automatically.

Yes, I'm using Visual Studio Code, not Visual Studio Community. The reason is it's VERY fast to launch and vastly superior color themes (in my opinion) compared to VS Community

I'd rather spend a week sorting this out once and for all than waiting 15-20sec every time I double click on VS Community...I just need to sort out this compilation matter and then I'm never going back to VS Community

By the way if is a time consuming to explain process no need to explain it to me, pointing me in the right direction (maybe a link) will do

Edited by MarcusAseth

##### Share on other sites

Weird, Community loads in < 10 seconds for me.  But I've read a few places where people were saying it loads slowly for them (mines installed on an SSD maybe that help, who knows).  Also, I think you will be losing time over your life instead of gaining it lol.  You can also download color themes online ;-)

But the cl command for minimal rebuild is /Gm, you'll need /Zi according to my command prompt tests though, /Zi is for debugging information, so maybe only with debug builds?).

Edit:

Also, found this, seems there is an option task.json file you can make: https://blogs.msdn.microsoft.com/vcblog/2016/10/24/building-your-c-application-with-visual-studio-code/

Edit #2: Fixed a few typos.

Edited by Mike2343

##### Share on other sites

Thanks, that was easier than expected!

Also I bet the fact you have VSC on SSD is a major factor, mine is on the hard drive x_x

Regarding VSC styles I don't like the fact that they only change the interior of the editor and rarely match the surrounding of the IDE, and even though VSC Themes plugin solves it the default themes it comes with are not so great (compared to VS Code) and I failed to find user made themes packs online. Also the visual simplicity of VS Code is a factor for me, VS Community clutter my brain with too many panels x_x

Many reasons   Anyway thanks

Edited by MarcusAseth

##### Share on other sites
On 04/02/2018 at 10:51 PM, MarcusAseth said:

Also I bet the fact you have VSC on SSD is a major factor, mine is on the hard drive x_x

Since the issue is resolved, and we're a little more free to drift off topic...

I can't emphasise nearly enough just how urgently you should save up the $150 for a basic SSD. Or better yet, the$230 for a ridiculously fast SSD.

It'll do more for your computer than a fairly significant CPU or GPU upgrade. Life is too short to run spinning platter drives for much other than backups...

##### Share on other sites

I actully have both on my pc, though when I purchased them people where talking about "short lifetime of SSD", so mine is used only to run the OS and everything else has to go in the hard drive. I'm just too afraid to break it

##### Share on other sites
36 minutes ago, MarcusAseth said:

I actully have both on my pc, though when I purchased them people where talking about "short lifetime of SSD", so mine is used only to run the OS and everything else has to go in the hard drive. I'm just too afraid to break it

You should be fine if you put all your software and your coding projects on the SSDs for performance reasons, and also keep a backup on another drive (and offsite, like GitHub or Bitbucket or even Dropbox).  I haven't had any of my SSDs fail..yet.  Knock on wood.

SSDs are just so noticably faster than HDDs, you should use it for anything that needs high random access throughput - loading programs, compiling, etc.  Use the bigger, cheaper HDD for larger files which don't need to be read as frequently or as quickly.

Edited by Nypyren

##### Share on other sites
5 hours ago, MarcusAseth said:

I actully have both on my pc, though when I purchased them people where talking about "short lifetime of SSD", so mine is used only to run the OS and everything else has to go in the hard drive. I'm just too afraid to break it

I have only a SSD (no HDD) in my notebook which I use for both programming and gaming. So far after 3 years of use, the SSD is still alive and running. You should not worry too much about the lifetime difference between SSD and HDD (I know lots of HDDs who eventually failed). Just make a backup independent of which drive you use.

On 2/5/2018 at 7:51 AM, MarcusAseth said:

though VSC Themes plugin solves it the default themes it comes with are not so great

You can tweak lots of colors yourself via the options, starting from a given theme of the Color Theme Editor for Visual Studio 2017.

##### Share on other sites
10 hours ago, MarcusAseth said:

I actully have both on my pc, though when I purchased them people where talking about "short lifetime of SSD", so mine is used only to run the OS and everything else has to go in the hard drive. I'm just too afraid to break it

This is probably going a bit off topic but I'll add my 5 cents.

I've had my 120 GB SSD for around 4 years. According to CrystalDiskInfo it has seen 56 TB of reads, 35 TB of writes, 1700 power on count, 28,110 power on hours (I suppose that makes an average of 16.5 hours per day) and it's still at 88% integrity. This leads me to believe average SSD will become morally and technologically obsolete way before it actually needs to be replaced. My pagefile, OS, all software, most games, and movies are on this SSD and it handles just fine. I did not torrent from it though (HDD has that role).

On a side note, my other HDD with 38,000 power on hours already has some reallocated sectors.

##### Share on other sites

You know, there is a vs option, mp which does multithreaded compilation, however I think it does not work with gm

i find it super fast though I also use the ide and it seems to only compile necessary files.

## Create an account

Register a new account

• 9
• 10
• 12
• 10
• 10
• ### Similar Content

• Hi,

I am working on a project where I'm trying to use Forward Plus Rendering on point lights. I have a simple reflective scene with many point lights moving around it. I am using effects file (.fx) to keep my shaders in one place. I am having a problem with Compute Shader code. I cannot get it to work properly and calculate the tiles and lighting properly.

Is there anyone that is wishing to help me set up my compute shader?
Thank you in advance for any replies and interest!

• I'm looking for some references that could help me learn how to program some really basic 2D enemy behaviours.
I wasn't sure whether to post this here or in the AI section but I think it might be more suitable to be posted here since it has more to do with basic maths than any AI related algorithms.
Could anyone help recommend some resources (books, posts, videos) that could help me understand how to properly implement the basics of enemy movement in 2d games ? So far I've only managed to get them to chase the player character and to stop moving on collision, but the movement is pretty unrealistic and once the collision occurs the enemies all "pile up" on the player character. I'm doing this in C++ so no guides that explain how to script this using an engine api please.

• Good Evening,
I want to make a 2D game which involves displaying some debug information. Especially for collision, enemy sights and so on ...
First of I was thinking about all those shapes which I need will need for debugging purposes: circles, rectangles, lines, polygons.
I am really stucked right now because of the fundamental question:
Where do I store my vertices positions for each line (object)? Currently I am not using a model matrix because I am using orthographic projection and set the final position within the VBO. That means that if I add a new line I would have to expand the "points" array and re-upload (recall glBufferData) it every time. The other method would be to use a model matrix and a fixed vbo for a line but it would be also messy to exactly create a line from (0,0) to (100,20) calculating the rotation and scale to make it fit.
If I proceed with option 1 "updating the array each frame" I was thinking of having 4 draw calls every frame for the lines vao, polygons vao and so on.
In addition to that I am planning to use some sort of ECS based architecture. So the other question would be:
Should I treat those debug objects as entities/components?
For me it would make sense to treat them as entities but that's creates a new issue with the previous array approach because it would have for example a transform and render component. A special render component for debug objects (no texture etc) ... For me the transform component is also just a matrix but how would I then define a line?
Treating them as components would'nt be a good idea in my eyes because then I would always need an entity. Well entity is just an id !? So maybe its a component?
Regards,
LifeArtist
• By nickyc95
Hi.
I'm kind of late to this party but I thought I would ask anyway as I haven't found a concrete answer.

When creating a game engine, when should you choose one methodology over another (more specifically OOP and DOD)? Which areas benefit from DOD? Which areas benefit from OOP? Do people typically mix multiple methodologies throughout a project? I.e. certain sub-systems created in one, and others in the another?
DOD - Data Oriented Design
OOP - Object Oriented Design

Pretty simple
Thanks
• By Estra
Memory Trees is a PC game and Life+Farming simulation game. Harvest Moon and Rune Factory , the game will be quite big. I believe that this will take a long time to finish
Looking for
Programmer
1 experience using Unity/C++
2 have a portfolio of Programmer
3 like RPG game ( Rune rune factory / zelda series / FF series )
4 Have responsibility + Time Management
and friendly easy working with others Programmer willing to use Skype for communication with team please E-mail me if you're interested
Split %: Revenue share. We can discuss. Fully Funded servers and contents
and friendly easy working with others willing to use Skype for communication with team please E-mail me if you're interested
we can talk more detail in Estherfanworld@gmail.com Don't comment here
Thank you so much for reading