BEST Visual Studio Setup for C++ Projects! — Transcript
Full transcript
- 0:04[Music]
- 0:06Hey, what's up guys? My name is Aerno.
- 0:08Welcome back to another
- 0:10video. Got my coffee means I can make a
- 0:13video now. So, today I thought I would
- 0:15kind of just make a little video. It's
- 0:18going to be a small one. Kind of a
- 0:19midweek thing for you guys where I just
- 0:21I just wanted to talk about something
- 0:23that I didn't feel would take that long.
- 0:25That being said, the amount of videos
- 0:26that I've started off being like this is
- 0:28going to be a short video and then it's
- 0:30ended up being something that's like
- 0:32half an hour long has been like I mean
- 0:34all of them really. But today we're just
- 0:36going to talk about the way that I set
- 0:37up my C++ projects. These aren't
- 0:40necessarily going to be the best
- 0:42settings for everyone ever. However, it
- 0:44is what I use. It's what I've kind of
- 0:45learned like grown into using over the
- 0:48years. And honestly, every single C++
- 0:50project or like and I'm not just talking
- 0:52about a single project. I'm talking
- 0:53about like a whole solution of projects.
- 0:55For every single one that I create from
- 0:57now on, pretty much I use these
- 0:59settings. So, let's just let's just jump
- 1:00in and take a look. So, we've just
- 1:02opened Visual Studio. We've got our
- 1:03start page here. Nothing's I haven't
- 1:05opened any kind of solution yet. I'm
- 1:07going to create a brand new project and
- 1:08solution here by hitting file, new, and
- 1:11then project. For now, I'm just going to
- 1:12go under Visual C++ General and create
- 1:15an empty project. And then I'll just
- 1:16call it something like new project. Now,
- 1:20in terms of the location, I like to
- 1:21store the projects that I develop under
- 1:23the C directory and not inside the user
- 1:25folder. That way, when I'm switching
- 1:27computers or anything like that, it's
- 1:28not going to break any paths. And
- 1:29really, it's just a lot easier to kind
- 1:31of store your development projects in
- 1:32some kind of central directory. So, I
- 1:34like to do something like C/dev and then
- 1:36maybe we'll call it new project or
- 1:38something like that. Now, because we've
- 1:40got create directory for solution, it
- 1:41will actually automatically create that
- 1:42new project folder. So, I don't need to
- 1:44write that. I'll just hit okay and we'll
- 1:45see what happens.
- 1:50I'm sure it's taking a while. Okay, so
- 1:52once we've got this new empty project,
- 1:54you can see we have absolutely no files
- 1:56here or anything like that. If I right
- 1:57click on the actual project and hit open
- 2:00folder in file explorer, you'll see the
- 2:02actual directory structure that Visual
- 2:04Studio has created for us. So what we've
- 2:06actually got is inside that dev folder,
- 2:08we've got that new project. We've got a
- 2:09solution file right next to there. You
- 2:11can see that also what Visual Studio has
- 2:13done is it's called our solution the
- 2:15exact same name as our project. So
- 2:17that's not necessarily something that
- 2:20you want. If this is just going to be a
- 2:22solution with a single project in it,
- 2:24then maybe it is. But, you know, if
- 2:26we're making like a game or something,
- 2:27then it's very it's very rare for us to
- 2:29kind of want our solution and project
- 2:31name to be identical. But anyway, this
- 2:34structure is actually not bad. Um, we've
- 2:36got a folder dedicated for our for our
- 2:38project. We've got both a VCX project
- 2:40file and a filters file. I'm not going
- 2:42to get too ind depth about all the
- 2:43different files Visual Studio creates.
- 2:45That might be an idea for another video,
- 2:46but basically the VCX project is our
- 2:49project file, which is just an XML file.
- 2:51And then we've also got a solution file,
- 2:53which is its own kind of weird format.
- 2:55It's a text file, though. Um, and that's
- 2:57in its own kind of directory. Okay,
- 2:59cool. I actually like this structure.
- 3:00I'm not going to change it too much, but
- 3:02you'll notice that also what we get here
- 3:04is a bunch of various folders. Now,
- 3:06these are not folders, right? These are
- 3:08things called filters. Filters are not
- 3:10folders. If I right click on new project
- 3:12here and do add, you'll see there's no
- 3:14new folder. It says new filter. And if I
- 3:16add a filter called churno or something,
- 3:18nothing is going to change on our disc.
- 3:20That's not the way that it works. This
- 3:21filters file, however, does contain
- 3:23these kind of virtual folders that we
- 3:25create. So these are fantastic for just
- 3:27organizing your source code within
- 3:28folders that don't actually exist on
- 3:30disk, but they do exist in this solution
- 3:33explorer view. So if I was to go into
- 3:35source files, for example, and add a new
- 3:37item, source files is in a folder. So,
- 3:39if I add an item or something called
- 3:41main.cpp, once it creates the file and
- 3:43everything, you'll see that it's
- 3:44actually just created that right here
- 3:45next to my project. And that's just I
- 3:47just that's just that's just messy,
- 3:49right? What like what why? So, what I
- 3:51like to do is I like to create a folder
- 3:53called source or src, which contains all
- 3:55of my source code and header files and
- 3:57all that stuff kind of in that folder so
- 3:59that my project files and any other
- 4:01resources that I might be using in my
- 4:03project are actually kind of nicely
- 4:04separated into folders. And that's
- 4:06something that that Visual Studio
- 4:07doesn't set up for you automatically. So
- 4:09you kind of have to roll with it. So if
- 4:10we go back to Visual Studio, we can
- 4:12click on our project here and a little
- 4:14button will appear here which says show
- 4:16all files. If we click that this view,
- 4:20this view is actually your directory
- 4:24structure that is on your disk that is
- 4:26on your hard drive. So if I right click
- 4:28now and hit add, you'll see the filter
- 4:29is replaced with new folder and I can
- 4:32actually make a folder called src.
- 4:34Right? If I alt tab back to my file
- 4:36explorer, look at that. We've got a
- 4:37folder called source. So, let's move
- 4:39this main.cpp file into that source
- 4:41directory. Now, I can do so using
- 4:43Windows Explorer, which would mean that
- 4:44I would have to manually update it in
- 4:46Visual Studio. Or I can just click and
- 4:47drag it like that. And you can see that
- 4:49on disk, it's actually moved it into
- 4:51that directory. Okay. So, now Visual
- 4:53Studio is actually behaving a little bit
- 4:54more like I would like it to. So, this
- 4:56kind of show all files button is
- 4:59incredibly useful and honestly, I kind
- 5:01of use that mostly. If we go back to our
- 5:03filters, you can see that main is still
- 5:05inside the source files. This is just a
- 5:07virtual organization kind of scheme,
- 5:11right? I can drag this to header files.
- 5:13It doesn't matter where this is, right?
- 5:14It could be just in no filters, which
- 5:16would mean it's here. I can just go
- 5:18ahead and delete all of these. In fact,
- 5:20it doesn't really matter. These this
- 5:22filter view is all just it's all fake,
- 5:25right? It's all just kind of there for
- 5:27you to just organize things into groups.
- 5:29It has no no relation to actual
- 5:32directory structure on disk. So, if I go
- 5:34back to show all files mode, there is my
- 5:36main.cpp file and I can do all of my
- 5:38code here. Let's go ahead and just write
- 5:40a quick hello world program. Just
- 5:42something for us to build. All right.
- 5:43Now, I'm going to compile this. So, I'll
- 5:44right click on my project, hit build,
- 5:46and you can see that everything will
- 5:48build successfully. So, where has Visual
- 5:51Studio put our .exe file? If we look at
- 5:53the output, you can see it's gone to new
- 5:55project, then debug, then new
- 5:56project.exe. So, debug being our
- 5:58currently selected configuration. If we
- 6:00open our file explorer once again and we
- 6:03check this out. So it hasn't actually
- 6:05you can see there's a debug folder here
- 6:07which is in the same directory as our
- 6:08VCS project file. However, if we open
- 6:10it, I don't see no no new project.exe in
- 6:14here, right? So what's going on here? If
- 6:15we read this a bit more closely, looks
- 6:16like it's just new project then debug.
- 6:18So it's not in that project folder. Huh.
- 6:20Interesting. So let's go back to new
- 6:22project and then go back again and then
- 6:24debug and then oh it's in here. How
- 6:27strange. Visual Studio. So, what's
- 6:29actually happened is it's put our
- 6:30intermediate files into a folder called
- 6:33debug in our project directory and our
- 6:36actual final executable binary into a
- 6:38folder called debug in our solution
- 6:40directory. I don't know who makes this
- 6:42stuff up. It's really quite annoying. I
- 6:45have not actually met any professional
- 6:48developer who leaves these settings.
- 6:51Everyone changes them because they just
- 6:54honestly they are weird. Now, it's not a
- 6:56really big problem to change these and
- 6:57you can create templates and stuff like
- 6:59that. So, I'm not roasting Microsoft too
- 7:01much for deciding to do this. I'm just
- 7:03saying that it's a little bit weird and
- 7:04especially for people kind of starting
- 7:06out who might not know that you can
- 7:07change this. It's it could actually be
- 7:10quite difficult to find your damn
- 7:11executable binary once you've built it.
- 7:13So anyway, so if we go back to Visual
- 7:16Studio, if we right click on our project
- 7:18and hit properties, you'll see that
- 7:21under active under our active
- 7:23configuration and platform, we have an
- 7:25output directory and we have an
- 7:27intermediate directory. So that's
- 7:28actually where everything's going. So
- 7:29you can see that everything that we
- 7:31write here, by the way, is going to be
- 7:32relative to the project file. So if I
- 7:35put something like intermediates here,
- 7:38it's going to be relative to that
- 7:40project file. So in the same directory
- 7:42as our project file which is this VCX
- 7:44project file it will actually make a
- 7:46folder called intermediates in this case
- 7:47and put them all there. Okay. So what I
- 7:49like to change this to now first of all
- 7:51I like to go to all configurations so
- 7:52that I'm editing all configurations. I'm
- 7:54not going to make any any I'm not going
- 7:56to save any of these changes that I made
- 7:57here. Um even all platforms. Okay. And
- 8:00then what I like to do is this for my
- 8:02output directory. I like to put my
- 8:04output directory in my solution
- 8:07directory slashbin
- 8:10slashplatform and then slash
- 8:12configuration and then end that with a
- 8:15slash as well. Okay, so what it's going
- 8:17to do in our case is put this into the
- 8:19solution directory which is the root of
- 8:21this whole thing. What that means and
- 8:24the reason I've actually chosen solution
- 8:25directory is because if we have multiple
- 8:28projects, right, for example, we build
- 8:30DLL files or something that are needed
- 8:32by our main application, we want them
- 8:34all to be in the same folder, right? I
- 8:36don't want to have to go into every
- 8:37project's folder and then deal with
- 8:39that. I just want all of my built
- 8:41binaries in one place because that's
- 8:43usually the typical case. You want them
- 8:45all there. So, they're going to be in my
- 8:47solution directory in a folder called
- 8:48bin, which stands for binaries, in the
- 8:50appropriate platform folder. So in our
- 8:52case really it'll only be win32 or x64
- 8:56and then inside a configuration. So
- 8:58either debug or release in our case. Now
- 9:00this last part putting it into a
- 9:02separate folder for each configuration.
- 9:04Again not something that I do all the
- 9:06time. Sometimes I just like to change
- 9:08the target name to maybe have debug
- 9:10appended to it for the debug build and
- 9:12potentially release or nothing at all
- 9:14appended to it for the release build.
- 9:16It's it varies honestly based on how I
- 9:19how I deal with my projects, but in this
- 9:20case, I'm just going to put them into a
- 9:22separate folder. Now, intermediate
- 9:24directories are going to be very
- 9:25similar. I'm going to put I'm going to
- 9:27I'm just going to copy everything from
- 9:29the output directory, put it into the
- 9:30intermediate directory. The only
- 9:32difference is that inside bin, I'm going
- 9:34to make a folder called intermediates
- 9:38and then put them there by platform, by
- 9:40configuration. Again, sometimes I put
- 9:42this intermediates folder at the very
- 9:43end so that it's already inside
- 9:44everything. But this way, it's just a
- 9:46little bit cleaner for you to be able to
- 9:47copy, say, the platform that you want
- 9:49and only have all the built binaries, no
- 9:51intermediate files. So, if I now hit
- 9:53okay, right, we can clean our project,
- 9:55which should get rid of a lot of the
- 9:57previous files. If not, cuz it never
- 9:59really does work that well. I like to go
- 10:00into the file explorer and just delete
- 10:02all of these files that I don't care
- 10:04about. So, all the debug directory. You
- 10:06can see that now I'll even delete this
- 10:07bin directory. You can see that now all
- 10:09we have is a solution file, the project,
- 10:12we've got the project filters and a user
- 10:13file which is just basically our current
- 10:15Visual Studio configuration. And then in
- 10:17source we've got main. So it's nice and
- 10:18clean. I'm going to go back to Visual
- 10:19Studio and I'm going to build. All
- 10:22right, cool. So if we go back here and
- 10:24we go to bin, we can see we've got
- 10:26intermediates and then Win32. So inside
- 10:28intermediates, we've got Win32 debug.
- 10:30That's all of our intermediate files
- 10:31such as our OBJ files. And then if we go
- 10:34back, you can see we've got win32 debug
- 10:36and then that is our exe file and we can
- 10:38run that and everything's fine. All
- 10:40right, cool. One little thing as well.
- 10:41You can see that we've got a double
- 10:42backslash here because of course I did
- 10:45forget that the solution directory,
- 10:46anything that has like project directory
- 10:48or solution directory actually has a
- 10:50backslash on it already because it's a
- 10:52directory name. So we can just go back
- 10:54and fix that up so that we don't get the
- 10:56double backslash. If you're not sure
- 10:57what one of these macros is equal to or
- 11:00you would like to see what it is, you
- 11:02can just go under edit here and then we
- 11:04can expand this macros view. And then
- 11:07over here we've got everything we want.
- 11:08So for example, that solution directory
- 11:10that I was talking about, you can see
- 11:11it's cdev new project. And you can see
- 11:13it does in fact end with a backslash.
- 11:15All right, cool. So that's pretty much
- 11:16it. That's all I just wanted to say.
- 11:17Setting up your directories, really
- 11:19important, really quick tip that that
- 11:21will just kind of make your life easier
- 11:22as far as organization goes. These are
- 11:24the settings that I use all the time. We
- 11:27might talk about more or less the
- 11:28compiler settings and linking settings
- 11:30and all of those kind of maybe release
- 11:31mode optimization settings in another
- 11:33video. I just wanted to show you guys
- 11:35the basis of how I set up every new C++
- 11:37project that I do. If you guys enjoy
- 11:39this video, please hit that like button,
- 11:41follow me on Twitter and
- 11:43Instagram, and and I will see you guys
- 11:48in the next video. Goodbye.
- 11:50[Music]
- 11:59[Music]
- 12:01Hey, hey,
- 12:03[Music]
- 12:04hey, hey, hey.
About this transcript
This page contains the full transcript of BEST Visual Studio Setup for C++ Projects! by The Cherno, generated from the public captions YouTube serves with the video. The transcript has 2,605 words across 366 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.