Compilation, Libraries and the pesky "unresolved external symbol" error

  Рет қаралды 5,011

VoxelRifts

VoxelRifts

Жыл бұрын

Understanding the Compilation Process is very important for anybody trying to get into compiled languages like C, C++, Rust, etc.
This is a video highlighting how this process works.
We start by going over the linker, symbols and object files, and using this as context for understanding different types of libraries: Static and Dynamic.
Discord: / discord
Relevant Links:
Just google it LUL.
(But really you'd get a lot better resources from googling than this video probably)
#C #C++ #Compilation
#MadeWithMotionCanvas

Пікірлер: 27
@jackthethinker
@jackthethinker Жыл бұрын
Back when I was learning C++, I wanted to use a library (SDL) to try make a game. I fell down such a deep rabbit hole of just tools like CMake and how you can compile that library yourself if you want. It was confusing but figured it out eventually. This video is a great example on how the code eventually becomes .exe files. I love seeing that in action. Pretty cool.
@krumpy8259
@krumpy8259 Жыл бұрын
I deeply admire these intricately constructed videos that thoroughly delve into and explain concepts down to their core. Thanks :D
@creativity5155
@creativity5155 Жыл бұрын
Every library i've ever used in C, had me on a stump because of linking problems. Videos like these are worth their length in gold. Thank you sooo much for such a clear and concise explanation.
@anon_y_mousse
@anon_y_mousse Жыл бұрын
A possibly interesting side-note here is that you can use `ar` to store the main() function in a library and generate a binary without passing any object files or source files to the compiler. Another possibly interesting side-note is that on Linux a Shared Object (.so file sort of like a .dll on Windows), can have a main and be called like a regular program as well, and there are some use cases for that. As for the first part talking about the difference between interpretation and compilation, in general every language can be dealt with in either way. Python can be compiled to a machine readable binary format, and it often gives a speed boost, but even languages like C could be interpreted if one felt so inclined to write an interpreter. I think the biggest stumbling block between switching back and forth is down to how much reflection a language has as well as how much the compiler does. C doesn't have to separate the preprocessor from the compiler, or for that matter the linker too, it just makes some really fantastic things easier to do.
@nikitasavelyev9171
@nikitasavelyev9171 Жыл бұрын
Thanks for this video. Very underappreciated effort. It shows how things look nice and tidy at the beginning with C and get really weird and complicated at the end with ugly compiler commands, macros, preprocessors etc. :)
@moopoo123
@moopoo123 11 ай бұрын
Thanks for the detailed video. This helps me toward my goal of being strong in the fundamentals.
@MrOnePieceRuffy
@MrOnePieceRuffy Жыл бұрын
Well.. Windows is Special here xD The DllMain Function is an optional symbol, but if declared it has to be declared as DllMain in _stdcall (like any Pascal or Windows API function convention). The reason is especially backward compitblity reasons, since you could load ANY DLL into the global Space with AppInit_DLLs. You can still load DLL's with it into the Global Space, but you have to run Windows 7, disable Secureboot or having a certificate from Microsoft. You can also just create a Driver and hook this function from there, but it also has to be loaded from a certificated Driver, which is easier in any case, than getting a certificate
@viniricardoferrera
@viniricardoferrera 8 ай бұрын
Great content! I'll be back for more!
@sapiosuicide1552
@sapiosuicide1552 11 сағат бұрын
Awesome
@zlsKeksia
@zlsKeksia 8 ай бұрын
@3:22 Isn't a translation unit typically the output of the preprocessor, often with a .i or .ii extension, rather than the compiler?
@voxelrifts
@voxelrifts 8 ай бұрын
Well technically a .i file is just a way to look at what is included in a certain translation unit, at a source level.
@zlsKeksia
@zlsKeksia 8 ай бұрын
@@voxelrifts oh i see! thanks for the clarification.
@yogxoth1959
@yogxoth1959 Жыл бұрын
I love your videos!
@asdasdasdasdasdasd3485
@asdasdasdasdasdasd3485 10 ай бұрын
This is a great channel, I really like the way you speak, very calm and informative, thank you for these videos, I really like C!!! I wanted to ask, are you working currently anywhere or are you a student, would you ever find a job in C like embedded or similar and in which software do you make your videos? I'm asking because I want to find a job in C, but seems it is not a safe route...
@voxelrifts
@voxelrifts 10 ай бұрын
I am a student yes. And I'm not an "only c" person. If I find a job that expects C knowledge I'd take it in a heartbeat, but if I don't, I still have other experience in other languages. I make videos using motion canvas.
@asdasdasdasdasdasd3485
@asdasdasdasdasdasd3485 10 ай бұрын
@@voxelrifts Thank you for the reply and keep up the good work!!!
@buggybaka
@buggybaka Жыл бұрын
W + I like the person who says I guy at the start
@bismajoyosumarto1237
@bismajoyosumarto1237 10 ай бұрын
Hey I know this is quite irrelevant but, since you're programming on Windows, I've been meaning to ask: what do you think about Makefiles, and make in general? I mean, to "automatically" compile and link many files (of a big project) with a single command, and/or to install a library or application from source. I've always wondered how C programmers on Windows go about it. Do you just replace it all with the static library files .lib/.a and the dynamic library files .dll/.so stuff? Or do you use something like CMake? I see you even got clang and the ls command, which aren't usually on Windows... did you get them from Cygwin or MSYS2 or something else? Any recommendations? Thank you sooo much for making this video, by the way! I find it very helpful!
@voxelrifts
@voxelrifts 10 ай бұрын
I'm sure makefiles are super nice to use on linux, but since they're not super nice to use on windows I don't use them at all. Instead I use batch/shell scripts for building projects since I control everything that happens in them easily. Clang can be easily installed on windows from the llvm github page whereas ls is just an alias that powershell provided there. So no msys or cygwin required :)
@Pedro-jj7gp
@Pedro-jj7gp Жыл бұрын
Nice one! What do you use to make the animations / edit your videos btw?
@voxelrifts
@voxelrifts Жыл бұрын
I use motion canvas and Da Vinci resolve :)
@niklasbognar
@niklasbognar Жыл бұрын
How about you make a video about Cmake and linking
@voxelrifts
@voxelrifts Жыл бұрын
I'm afraid I'm not very familiar with cmake :P
@k_otey
@k_otey Жыл бұрын
16:30 C you next time ☠️
@catbb
@catbb Жыл бұрын
:)
@urielemmanuelpelaezhernand3904
@urielemmanuelpelaezhernand3904 Жыл бұрын
Is missing to explain how do you find the symbols saved in the header, the lib or the os files"... Equivalent problem of knowing where the header files are located and how to list them. ⭐⭐⭐
@redcrafterlppa303
@redcrafterlppa303 Жыл бұрын
You can just open the header files and look at their symbols. And a well documented library has some sort of documentation where all symbols are explained. Editors will even auto suggest you the symbols when you included the header files. Also aren't the header files usually included in the Library zip? and os headers are usually in a documented folder that is automatically included by compilers.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 73 М.
Why are if statements in shaders heavily discouraged?
11:22
VoxelRifts
Рет қаралды 4,9 М.
Be kind🤝
00:22
ISSEI / いっせい
Рет қаралды 12 МЛН
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 19 МЛН
BRUSH ONE’S TEETH WITH A CARDBOARD TOOTHBRUSH!#asmr
00:35
HAYATAKU はやたく
Рет қаралды 6 МЛН
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 53 МЛН
I made a language for the Nintendo DS
26:19
VoxelRifts
Рет қаралды 8 М.
Making a calculator from scratch - #SoME3
24:25
VoxelRifts
Рет қаралды 29 М.
Advanced C: The UB and optimizations that trick good programmers.
1:12:34
Eskil Steenberg
Рет қаралды 136 М.
Advanced C #20: Error Handling
7:57
Charles Cabergs
Рет қаралды 2,8 М.
A Quick, Easy and Extendable OpenGL Renderer in 250 LOC!
13:18
No really, how does Linux run executables?
8:37
Jacob Pradels
Рет қаралды 178 М.
Idiots Around Europe | Try Not To Laugh
30:14
FailArmy
Рет қаралды 29 МЛН
Signals. I spent 2 years to understand this part.
21:24
kimylamp
Рет қаралды 144 М.
Moments of Instant Karma Caught on Camera !
20:34
Binge Watch
Рет қаралды 272 М.
Making a Chip-8 Emulator
9:18
VoxelRifts
Рет қаралды 10 М.
Be kind🤝
00:22
ISSEI / いっせい
Рет қаралды 12 МЛН