title
Using Libraries in C++ (Static Linking)

description
Patreon ► https://patreon.com/thecherno Twitter ► https://twitter.com/thecherno Instagram ► https://instagram.com/thecherno Discord ► https://thecherno.com/discord Series Playlist ► https://thecherno.com/cpp Thank you to the following Patreon supporters: - Samuel Egger - Dominic Pace - Kevin Gregory Agwaze - Sébastien Bervoets Gear I use: ----------------- BEST laptop for programming! ► http://geni.us/pakTES My FAVOURITE keyboard for programming! ► http://geni.us/zNhB FAVOURITE monitors for programming! ► http://geni.us/Ig6KBq MAIN Camera ► http://geni.us/t6xyDRO MAIN Lens ► http://geni.us/xGoDWT Second Camera ► http://geni.us/CYUQ Microphone ► http://geni.us/wqO6g7K

detail
{'title': 'Using Libraries in C++ (Static Linking)', 'heatmap': [{'end': 575.998, 'start': 550.481, 'weight': 0.87}, {'end': 629.31, 'start': 601.897, 'weight': 0.775}, {'end': 744.576, 'start': 691.589, 'weight': 0.715}, {'end': 946.831, 'start': 931.835, 'weight': 0.701}, {'end': 1013.259, 'start': 998.287, 'weight': 0.765}], 'summary': 'Discusses managing library dependencies in c++ projects, emphasizing simplicity and preference for managing library dependencies, linking against pre-built binaries, covering organizational structure of c++ libraries, and explaining differences between static and dynamic linking with specific emphasis on using binaries for windows and matching them with the application target.', 'chapters': [{'end': 289.843, 'segs': [{'end': 78.134, 'src': 'embed', 'start': 54.327, 'weight': 3, 'content': [{'end': 61.569, 'text': 'My ideal project setup is that if you check out my repository, my code repository from GitHub or whatever,', 'start': 54.327, 'duration': 7.242}, {'end': 70.512, 'text': 'you should have everything you need in that repository just straight away for you to actually be able to compile and run the application or the project or whatever.', 'start': 61.569, 'duration': 8.943}, {'end': 75.413, 'text': 'right?. There should be no kind of syncing up with package managers, downloading other libraries all of that stuff.', 'start': 70.512, 'duration': 4.901}, {'end': 78.134, 'text': 'I hate all of that, especially with C++.', 'start': 75.713, 'duration': 2.421}], 'summary': 'Ideal project setup: repository contains all necessary files for compiling and running, no need for syncing or downloading libraries.', 'duration': 23.807, 'max_score': 54.327, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k054327.jpg'}, {'end': 136.989, 'src': 'embed', 'start': 94.34, 'weight': 1, 'content': [{'end': 102.905, 'text': "So for that reason I tend to actually keep versions of my dependencies of the libraries that I'm using in the actual solution,", 'start': 94.34, 'duration': 8.565}, {'end': 105.106, 'text': 'in the actual project folder.', 'start': 102.905, 'duration': 2.201}, {'end': 111.57, 'text': "So I've actually got copies of those physical binaries or code, depending on which way I go with that as well,", 'start': 105.186, 'duration': 6.384}, {'end': 114.692, 'text': 'in my actual kind of working directory of my solution.', 'start': 111.57, 'duration': 3.122}, {'end': 116.053, 'text': 'That kind of brings me to another point.', 'start': 114.892, 'duration': 1.161}, {'end': 120.937, 'text': 'Should I be compiling these myself or should I just be linking against pre-built binaries?', 'start': 116.673, 'duration': 4.264}, {'end': 126.941, 'text': 'Now, for most serious projects, I would absolutely recommend actually building the source code.', 'start': 121.437, 'duration': 5.504}, {'end': 134.147, 'text': "If you're using Visual Studio, you can just add another project which contains your kind of source code of your dependency of your library,", 'start': 127.321, 'duration': 6.826}, {'end': 136.989, 'text': 'and then compile that into either a static or dynamic library.', 'start': 134.147, 'duration': 2.842}], 'summary': 'Keep versions of dependencies in project folder and compile source code for serious projects.', 'duration': 42.649, 'max_score': 94.34, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k094340.jpg'}, {'end': 224.554, 'src': 'embed', 'start': 198.835, 'weight': 0, 'content': [{'end': 204.138, 'text': 'This is especially true with like Mac and Linux because for Unix systems, people usually just love building code.', 'start': 198.835, 'duration': 5.303}, {'end': 208.381, 'text': 'For Windows, a lot of people who use Windows just want stuff to work.', 'start': 204.638, 'duration': 3.743}, {'end': 210.442, 'text': 'Like me, I just want things to work.', 'start': 208.821, 'duration': 1.621}, {'end': 212.303, 'text': "So that's why pre-built binaries exist.", 'start': 210.842, 'duration': 1.461}, {'end': 217.947, 'text': "And again I'm just saying that in a more kind of professional and larger project, in a space where I actually had time,", 'start': 212.683, 'duration': 5.264}, {'end': 221.21, 'text': 'I would for sure compile it myself, because it helps with debugging.', 'start': 218.567, 'duration': 2.643}, {'end': 224.554, 'text': 'It helps if you want to modify the library and change it a little bit.', 'start': 221.611, 'duration': 2.943}], 'summary': 'Mac and linux users often build code, while windows users prefer pre-built binaries for simplicity and functionality.', 'duration': 25.719, 'max_score': 198.835, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0198835.jpg'}], 'start': 0.089, 'title': 'Managing library dependencies in c++ projects', 'summary': "Discusses challenges of using external libraries, emphasizing the simplicity of the process and the author's preference, focusing on managing library dependencies and linking against pre-built binaries, with specific emphasis on using binaries for windows and matching them with the application target.", 'chapters': [{'end': 93.879, 'start': 0.089, 'title': 'Using external libraries in c++', 'summary': "Discusses the challenges of using external libraries in c++ projects, highlighting the simplicity of the process and the author's preference for having all necessary components included in the repository, aiming for seamless compilation and execution.", 'duration': 93.79, 'highlights': ['The author emphasizes the challenges of using external libraries in C++ projects, expressing frustration with the complexity and preference for a straightforward setup.', 'The author advocates for having all necessary components included in the repository, promoting the idea of seamless compilation and execution for anyone accessing the code.', "The chapter provides insights into strategies for dealing with libraries in C++, highlighting the author's preferred approach and expressing disdain for the concept of package managers and syncing with external repositories."]}, {'end': 185.068, 'start': 94.34, 'title': 'Managing library dependencies in projects', 'summary': 'Discusses managing library dependencies in projects, including the preference for building source code for serious projects and linking against pre-built binaries for quick or non-serious projects, specifically focusing on linking against the glfw library for opengl programming.', 'duration': 90.728, 'highlights': ['Compiling source code is recommended for serious projects, while linking against pre-built binaries is suitable for quick or non-serious projects, providing quicker and easier setup.', 'Managing library dependencies by including physical copies of binaries or code in the project folder facilitates easy access and maintenance of dependencies within the working directory.', "Today's focus is on linking against the GLFW library for OpenGL programming, elaborating on the process and its significance in graphics programming."]}, {'end': 289.843, 'start': 185.208, 'title': 'Compiling and using binaries for windows', 'summary': 'Discusses the importance of using pre-built binaries for windows, including the need to match the binaries with the application target and the availability of pre-compiled binaries for windows while requiring manual compilation for mac and linux.', 'duration': 104.635, 'highlights': ['The importance of using pre-built binaries for Windows, including the need to match the binaries with the application target and the availability of pre-compiled binaries for Windows while requiring manual compilation for Mac and Linux.', "The need to choose 32-bit or 64-bit binaries based on the application target, as mismatched binaries won't link together.", 'The availability of pre-compiled binaries for Windows on glfw.org while requiring manual compilation for Linux and Mac OS.']}], 'duration': 289.754, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k089.jpg', 'highlights': ['The importance of using pre-built binaries for Windows, including the need to match the binaries with the application target and the availability of pre-compiled binaries for Windows while requiring manual compilation for Mac and Linux.', 'Compiling source code is recommended for serious projects, while linking against pre-built binaries is suitable for quick or non-serious projects, providing quicker and easier setup.', 'Managing library dependencies by including physical copies of binaries or code in the project folder facilitates easy access and maintenance of dependencies within the working directory.', 'The author advocates for having all necessary components included in the repository, promoting the idea of seamless compilation and execution for anyone accessing the code.']}, {'end': 497.24, 'segs': [{'end': 318.052, 'src': 'embed', 'start': 289.843, 'weight': 0, 'content': [{'end': 292.723, 'text': "once i've downloaded and extracted them, we'll have this folder over here.", 'start': 289.843, 'duration': 2.88}, {'end': 298.585, 'text': 'inside there we have a bunch of folders and some other text files, and this is kind of the typical layout, i guess,', 'start': 292.723, 'duration': 5.862}, {'end': 301.605, 'text': 'or the typical organizational structure that we have with libraries.', 'start': 298.585, 'duration': 3.02}, {'end': 307.546, 'text': 'in c++ there are two parts to a library usually includes and libraries right?', 'start': 301.605, 'duration': 5.941}, {'end': 311.308, 'text': 'So an include kind of directory and a library directory or a lib directory.', 'start': 307.566, 'duration': 3.742}, {'end': 314.65, 'text': 'So what the include directory is, is a bunch of header files.', 'start': 311.708, 'duration': 2.942}, {'end': 318.052, 'text': "If you don't know how linking works in C++, or what I even mean by linking,", 'start': 314.85, 'duration': 3.202}], 'summary': 'In c++, libraries typically have include and library directories. the include directory contains header files.', 'duration': 28.209, 'max_score': 289.843, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0289843.jpg'}, {'end': 385.128, 'src': 'embed', 'start': 359.433, 'weight': 1, 'content': [{'end': 364.095, 'text': 'Static linking means that the library actually gets basically put into your executable.', 'start': 359.433, 'duration': 4.662}, {'end': 365.696, 'text': "So just it's inside your .", 'start': 364.156, 'duration': 1.54}, {'end': 368.698, 'text': 'exe file or whatever your executable is for your operating system.', 'start': 365.696, 'duration': 3.002}, {'end': 372, 'text': 'Whereas a dynamic library gets actually linked at runtime.', 'start': 369.138, 'duration': 2.862}, {'end': 378.163, 'text': 'So you still do have some kind of linkage, You can choose to load a dynamic library kind of just on the fly.', 'start': 372.04, 'duration': 6.123}, {'end': 382.446, 'text': "Literally, there's a function called load library, which you can use in the Windows API as an example.", 'start': 378.524, 'duration': 3.922}, {'end': 385.128, 'text': 'And that will load you like your dynamic library.', 'start': 382.806, 'duration': 2.322}], 'summary': 'Static linking puts library in executable, while dynamic linking happens at runtime.', 'duration': 25.695, 'max_score': 359.433, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0359433.jpg'}, {'end': 458.78, 'src': 'embed', 'start': 430.925, 'weight': 2, 'content': [{'end': 438.09, 'text': 'Linking statically can technically result in a faster application, because there are several optimizations that can be applied,', 'start': 430.925, 'duration': 7.165}, {'end': 443.313, 'text': "since we actually know the function that we're linking kind of at link time.", 'start': 438.09, 'duration': 5.223}, {'end': 446.135, 'text': "Whereas with dynamic libraries, we don't know what's going to happen.", 'start': 443.513, 'duration': 2.622}, {'end': 447.315, 'text': 'We have to leave it intact.', 'start': 446.175, 'duration': 1.14}, {'end': 452.158, 'text': "And when the library actually gets loaded by our application at runtime, that's when the paths kind of get patched up.", 'start': 447.475, 'duration': 4.683}, {'end': 458.78, 'text': "usually static linking is the way to go, but for this video i'm going to demonstrate both of those strategies.", 'start': 453.679, 'duration': 5.101}], 'summary': 'Static linking can result in faster application with known functions at link time. dynamic libraries require paths to be patched up at runtime.', 'duration': 27.855, 'max_score': 430.925, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0430925.jpg'}], 'start': 289.843, 'title': 'C++ library organization and static vs dynamic linking', 'summary': 'Covers the organizational structure of c++ libraries, including include and lib directories, and explains the differences between static and dynamic linking, highlighting the benefits of static linking such as faster application speed and optimization.', 'chapters': [{'end': 340.556, 'start': 289.843, 'title': 'Library organization in c++', 'summary': 'Explains the typical organizational structure of libraries in c++, with include and lib directories containing header files and pre-built binaries, respectively, and covers the two phases of dynamic and static libraries.', 'duration': 50.713, 'highlights': ['The typical organizational structure of libraries in C++ includes include and lib directories, containing header files and pre-built binaries, respectively.', 'The include directory contains header files required to use functions in the pre-built binaries.', 'The lib directory contains the pre-built binaries, which usually encompass dynamic and static libraries.']}, {'end': 497.24, 'start': 341.657, 'title': 'Static vs dynamic linking', 'summary': 'Discusses the differences between static and dynamic linking, with an emphasis on the advantages of static linking, including faster application speed and better optimization, while also addressing the process of setting up include and library files for both types of linking.', 'duration': 155.583, 'highlights': ['Static linking means that the library actually gets basically put into your executable. Static linking involves placing the library inside the executable file, which can lead to faster application speed and better optimization.', 'Linking statically can technically result in a faster application, because there are several optimizations that can be applied. Static linking can lead to a faster application due to the ability to apply several optimizations during the linking process.', 'You can choose if you want to link statically or dynamically. The flexibility to choose between static and dynamic linking is provided, allowing for tailored linking based on specific requirements.', "There's just that difference of whether or not your library actually gets compiled into your . exe file or linked into your . exe file. The distinction lies in whether the library is compiled into the .exe file or linked into it, which impacts the dependency and runtime loading.", "We're going to talk a lot about the differences between static and dynamic linking in another video specifically about that. Further discussions on the differences between static and dynamic linking are planned for another video, providing a more comprehensive understanding of the topic."]}], 'duration': 207.397, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0289843.jpg', 'highlights': ['The typical organizational structure of libraries in C++ includes include and lib directories, containing header files and pre-built binaries, respectively.', 'Static linking means that the library actually gets basically put into your executable.', 'Linking statically can technically result in a faster application, because there are several optimizations that can be applied.', 'The flexibility to choose between static and dynamic linking is provided, allowing for tailored linking based on specific requirements.']}, {'end': 1104.856, 'segs': [{'end': 525.824, 'src': 'embed', 'start': 497.28, 'weight': 0, 'content': [{'end': 499.342, 'text': "I've got this hello world project here in Visual Studio.", 'start': 497.28, 'duration': 2.062}, {'end': 500.403, 'text': "It's very basic stuff.", 'start': 499.362, 'duration': 1.041}, {'end': 505.689, 'text': "But what I'm actually going to do is inside the solution directory, make a folder called dependencies.", 'start': 500.523, 'duration': 5.166}, {'end': 508.833, 'text': 'This is how I actually manage my dependencies in my libraries.', 'start': 505.769, 'duration': 3.064}, {'end': 512.095, 'text': "Inside dependencies, I'll make another folder called glfw.", 'start': 509.313, 'duration': 2.782}, {'end': 517.518, 'text': "And inside there, I'm going to put the files that I actually downloaded, which are the glfw library.", 'start': 512.495, 'duration': 5.023}, {'end': 519.64, 'text': 'So include and libvc2015.', 'start': 517.818, 'duration': 1.822}, {'end': 525.824, 'text': "You can see here that they've actually appended kind of which compiler they used to actually compile this library file.", 'start': 520.2, 'duration': 5.624}], 'summary': 'Setting up dependencies in visual studio for a hello world project, including glfw library files.', 'duration': 28.544, 'max_score': 497.28, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0497280.jpg'}, {'end': 583.283, 'src': 'heatmap', 'start': 550.481, 'weight': 0.87, 'content': [{'end': 553.503, 'text': 'Include you can see has a glfw folder and then a bunch of header files.', 'start': 550.481, 'duration': 3.022}, {'end': 556.605, 'text': 'Perfect And lib has three files for us.', 'start': 553.623, 'duration': 2.982}, {'end': 563.91, 'text': "glfw3.dll is the runtime kind of dynamic link library that we actually use if we're linking dynamically at runtime.", 'start': 556.845, 'duration': 7.065}, {'end': 572.115, 'text': "And glfw3.dll.lib is actually kind of the static library that we use with the DLL, so that we don't have to actually ask the DLL.", 'start': 564.15, 'duration': 7.965}, {'end': 575.998, 'text': 'Hey, can I please have a bunch of function pointers to all of these functions?', 'start': 572.115, 'duration': 3.883}, {'end': 583.283, 'text': 'The idea is that this lib file actually contains all of the locations of the functions and symbols inside glfw3.dll,', 'start': 576.138, 'duration': 7.145}], 'summary': 'The lib folder contains glfw3.dll and glfw3.dll.lib, used for dynamic and static linking.', 'duration': 32.802, 'max_score': 550.481, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0550481.jpg'}, {'end': 583.283, 'src': 'embed', 'start': 553.623, 'weight': 2, 'content': [{'end': 556.605, 'text': 'Perfect And lib has three files for us.', 'start': 553.623, 'duration': 2.982}, {'end': 563.91, 'text': "glfw3.dll is the runtime kind of dynamic link library that we actually use if we're linking dynamically at runtime.", 'start': 556.845, 'duration': 7.065}, {'end': 572.115, 'text': "And glfw3.dll.lib is actually kind of the static library that we use with the DLL, so that we don't have to actually ask the DLL.", 'start': 564.15, 'duration': 7.965}, {'end': 575.998, 'text': 'Hey, can I please have a bunch of function pointers to all of these functions?', 'start': 572.115, 'duration': 3.883}, {'end': 583.283, 'text': 'The idea is that this lib file actually contains all of the locations of the functions and symbols inside glfw3.dll,', 'start': 576.138, 'duration': 7.145}], 'summary': 'Perfect and lib provides glfw3.dll and glfw3.dll.lib for dynamic linking at runtime.', 'duration': 29.66, 'max_score': 553.623, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0553623.jpg'}, {'end': 629.31, 'src': 'heatmap', 'start': 601.897, 'weight': 0.775, 'content': [{'end': 606.439, 'text': 'glfw3.lib, which you can see is significantly bigger than the other ones, is the static library.', 'start': 601.897, 'duration': 4.542}, {'end': 614.382, 'text': "so this is what we link if we don't want compile time linking, and if we do that, we don't need this dll file to be with our exe file at runtime.", 'start': 606.439, 'duration': 7.943}, {'end': 614.923, 'text': 'okay, cool.', 'start': 614.382, 'duration': 0.541}, {'end': 616.103, 'text': "so let's actually link this stuff.", 'start': 614.923, 'duration': 1.18}, {'end': 620.485, 'text': "i'm going to right click on my hello world project, hit properties and the first thing i'll actually do,", 'start': 616.103, 'duration': 4.382}, {'end': 624.267, 'text': "i'll go to cc++ general and then in additional include directories.", 'start': 620.485, 'duration': 3.782}, {'end': 626.648, 'text': "i'm going to specify my additional include directory.", 'start': 624.267, 'duration': 2.381}, {'end': 629.31, 'text': 'now note your configuration and platform.', 'start': 627.208, 'duration': 2.102}], 'summary': 'Glfw3.lib is the static library for compile time linking, eliminating the need for dll file at runtime.', 'duration': 27.413, 'max_score': 601.897, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0601897.jpg'}, {'end': 744.576, 'src': 'heatmap', 'start': 691.589, 'weight': 0.715, 'content': [{'end': 696.312, 'text': "you can see that it's inside Another hello world folder, but the one that we care about is solution directory.", 'start': 691.589, 'duration': 4.723}, {'end': 705.297, 'text': "So we'll start off there and then we'll basically get that relative path, which in this case is Dependencies, GLFW and include.", 'start': 696.312, 'duration': 8.985}, {'end': 710.76, 'text': 'so I can just grab that and really just copy the end of that path, starting in my solution directory folder.', 'start': 705.297, 'duration': 5.463}, {'end': 712.962, 'text': "I'll paste it into here hit enter and that's it.", 'start': 710.76, 'duration': 2.202}, {'end': 713.882, 'text': "I'm done.", 'start': 713.102, 'duration': 0.78}, {'end': 718.484, 'text': 'what I can now do is is basically just include files relative to this directory.', 'start': 713.882, 'duration': 4.602}, {'end': 722.356, 'text': 'so this directory contains a glfw folder which has a file called glw3..', 'start': 718.484, 'duration': 3.872}, {'end': 728.728, 'text': 'h so guess what i can do i can just come in here and type in include glfw slash glfw3.', 'start': 722.356, 'duration': 6.372}, {'end': 731.229, 'text': 'h just like that, and that will actually work.', 'start': 728.728, 'duration': 2.501}, {'end': 734.891, 'text': 'if i hit ctrl f7 to compile my code, you can see that i get no errors.', 'start': 731.229, 'duration': 3.662}, {'end': 739.494, 'text': 'Now, because this is a compiler-specified include path, I can also use angular brackets.', 'start': 735.211, 'duration': 4.283}, {'end': 744.576, 'text': 'And this kind of comes to the debate of do I use angular brackets or do I just use quotes??', 'start': 739.934, 'duration': 4.642}], 'summary': 'Demonstrates using relative paths for including files, resulting in successful compilation.', 'duration': 52.987, 'max_score': 691.589, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0691589.jpg'}, {'end': 963.802, 'src': 'heatmap', 'start': 930.134, 'weight': 1, 'content': [{'end': 931.655, 'text': "So I'm going to grab this and copy it.", 'start': 930.134, 'duration': 1.521}, {'end': 938.639, 'text': "And then I'm going to come back to additional library directories, type in solution dir, and then paste in that path just like that.", 'start': 931.835, 'duration': 6.804}, {'end': 946.831, 'text': "Okay, so I've specified a library directory, and then I've also specified the name of a library file that is relative to that library directory.", 'start': 939.286, 'duration': 7.545}, {'end': 953.075, 'text': "So if I hit, okay, and I try and build this now, you can see that this works fine and we don't actually get any errors.", 'start': 947.151, 'duration': 5.924}, {'end': 958.398, 'text': "And if I was to, for example, run this, let's just print the result of this to the console here.", 'start': 953.515, 'duration': 4.883}, {'end': 963.802, 'text': 'five you can see that we actually get one printing here, which basically means that GLFW initialized successfully.', 'start': 958.398, 'duration': 5.404}], 'summary': 'Specified library directory and file, build without errors, glfw initialized successfully.', 'duration': 33.668, 'max_score': 930.134, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0930134.jpg'}, {'end': 1027.703, 'src': 'heatmap', 'start': 998.287, 'weight': 0.765, 'content': [{'end': 999.969, 'text': 'the idea of this will actually work.', 'start': 998.287, 'duration': 1.682}, {'end': 1007.057, 'text': "However, in this specific case, we get an error because glfw is actually a C library and what we're doing here is mangling the name with C++.", 'start': 1000.029, 'duration': 7.028}, {'end': 1013.259, 'text': "I'll have a video specifically about kind of using C with C++ and name mangling and actually what's going on here.", 'start': 1007.978, 'duration': 5.281}, {'end': 1021.522, 'text': 'But to cut this short, we need to actually add extern C to this function declaration, which basically just says that preserve this name as it is,', 'start': 1013.68, 'duration': 7.842}, {'end': 1024.782, 'text': "because you'll be linking against a library that was built in C.", 'start': 1021.522, 'duration': 3.26}, {'end': 1027.703, 'text': 'So now if we compile this code, you can see that it works successfully.', 'start': 1024.782, 'duration': 2.921}], 'summary': 'Adding extern c to the function declaration fixed the error, making the code compile successfully.', 'duration': 29.416, 'max_score': 998.287, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0998287.jpg'}], 'start': 497.28, 'title': 'Managing dependencies in visual studio', 'summary': 'Explains creating folder structure, linking library files, specifying include and library directories in visual studio to ensure compatibility and successful code compilation and execution.', 'chapters': [{'end': 1104.856, 'start': 497.28, 'title': 'Managing dependencies in visual studio', 'summary': 'Explains how to manage dependencies in visual studio by creating a folder structure, linking library files, and specifying include and library directories, ensuring compatibility and successful compilation and execution of the code.', 'duration': 607.576, 'highlights': ['Creating a folder structure to manage dependencies by making a folder called dependencies and another folder called glfw inside it, and adding the downloaded files for the glfw library, including include and libvc2015 folders. Organizing dependencies by creating a structured folder system to manage library files and ensure easy access and management.', 'Explaining the purpose of glfw3.dll, glfw3.dll.lib, and glfw3.lib files, and their roles in runtime linking and compile time linking. Detailing the functionalities of different library files and their significance in linking and using the glfw library in the Visual Studio project.', 'Specifying additional include and library directories, ensuring relative paths to maintain code portability and compatibility for other users. Addressing the importance of specifying relative paths for include and library directories to ensure code portability and compatibility for other users.']}], 'duration': 607.576, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/or1dAmUO8k0/pics/or1dAmUO8k0497280.jpg', 'highlights': ['Creating a folder structure to manage dependencies by making a folder called dependencies and another folder called glfw inside it, and adding the downloaded files for the glfw library, including include and libvc2015 folders.', 'Specifying additional include and library directories, ensuring relative paths to maintain code portability and compatibility for other users.', 'Explaining the purpose of glfw3.dll, glfw3.dll.lib, and glfw3.lib files, and their roles in runtime linking and compile time linking.']}], 'highlights': ['The importance of using pre-built binaries for Windows, including the need to match the binaries with the application target and the availability of pre-compiled binaries for Windows while requiring manual compilation for Mac and Linux.', 'Compiling source code is recommended for serious projects, while linking against pre-built binaries is suitable for quick or non-serious projects, providing quicker and easier setup.', 'Managing library dependencies by including physical copies of binaries or code in the project folder facilitates easy access and maintenance of dependencies within the working directory.', 'The author advocates for having all necessary components included in the repository, promoting the idea of seamless compilation and execution for anyone accessing the code.', 'The typical organizational structure of libraries in C++ includes include and lib directories, containing header files and pre-built binaries, respectively.', 'Static linking means that the library actually gets basically put into your executable.', 'Linking statically can technically result in a faster application, because there are several optimizations that can be applied.', 'The flexibility to choose between static and dynamic linking is provided, allowing for tailored linking based on specific requirements.', 'Creating a folder structure to manage dependencies by making a folder called dependencies and another folder called glfw inside it, and adding the downloaded files for the glfw library, including include and libvc2015 folders.', 'Specifying additional include and library directories, ensuring relative paths to maintain code portability and compatibility for other users.', 'Explaining the purpose of glfw3.dll, glfw3.dll.lib, and glfw3.lib files, and their roles in runtime linking and compile time linking.']}