Using Libraries in C++ (Static Linking)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2017
  • Patreon ► / thecherno
    Twitter ► / thecherno
    Instagram ► / thecherno
    Discord ► thecherno.com/discord
    Series Playlist ► 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! ► geni.us/pakTES
    My FAVOURITE keyboard for programming! ► geni.us/zNhB
    FAVOURITE monitors for programming! ► geni.us/Ig6KBq
    MAIN Camera ► geni.us/t6xyDRO
    MAIN Lens ► geni.us/xGoDWT
    Second Camera ► geni.us/CYUQ
    Microphone ► geni.us/wqO6g7K

ความคิดเห็น • 401

  • @ryleypowell8164
    @ryleypowell8164 6 ปีที่แล้ว +915

    Would love to see a video that explains "Make" files and using things such as CMake

    • @groberti
      @groberti 5 ปีที่แล้ว +31

      That would be great, "Makefiles" are pretty complicated imho

    • @iamk5686
      @iamk5686 5 ปีที่แล้ว +11

      @@groberti 100%

    • @iamk5686
      @iamk5686 5 ปีที่แล้ว +15

      @@groberti Especially for beginners

    • @lordangus77
      @lordangus77 5 ปีที่แล้ว +38

      I'm agree!! what if we don't use visual studio?

    • @lordangus77
      @lordangus77 5 ปีที่แล้ว +6

      Would be great see how to do this with cmake

  • @ags0004
    @ags0004 5 ปีที่แล้ว +138

    0:32 "its pretty simple!" said no CMake user ever!

    • @iamk5686
      @iamk5686 5 ปีที่แล้ว +12

      @Spixmaster Pain in the ass for real

    • @supersquare
      @supersquare 4 ปีที่แล้ว +3

      Lmao I feel you

    • @amicloud_yt
      @amicloud_yt 3 ปีที่แล้ว +2

      ...i just spent 2 hours messing with CMake. right in the feels

    • @user-ux2kk5vp7m
      @user-ux2kk5vp7m 3 ปีที่แล้ว +1

      Make > CMake

  • @serkanozturk4217
    @serkanozturk4217 ปีที่แล้ว +38

    Personal Notes:
    - There are two parts in a library usually: includes and libraries. İnclude directory has a bunch of header files and lib directory has those pre-built binaries.
    - Dynamic library is loaded(linked) into program at runtime, dynamic library can be anywhere and you do the linking whereas static library is put(compiled) into your executable program
    - We have to point our compiler to header files (include files) and then we also have to point out our linker to library files.

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      And don't forget the library names :P

  • @matheuspinheirodesousa7911
    @matheuspinheirodesousa7911 6 ปีที่แล้ว +202

    1:37 watching on a linux platform, a windows sound echoes
    wtf?

    • @rosshoyt2030
      @rosshoyt2030 5 ปีที่แล้ว +11

      he probably had his audio inputs a little messed up while he was recording the video, so his system audio got routed into the audio track in his video software :P

    • @user-it6jd1sb6k
      @user-it6jd1sb6k 3 ปีที่แล้ว +11

      go home drunk, you are linux

    • @rishitsingh6621
      @rishitsingh6621 3 ปีที่แล้ว +1

      yeah lol

    • @parsablack7886
      @parsablack7886 3 ปีที่แล้ว

      lol

    • @kartikanand5374
      @kartikanand5374 3 ปีที่แล้ว

      lol, yes

  • @RandomGuyyy
    @RandomGuyyy 6 ปีที่แล้ว +235

    I'd be interested to see the "importing source code into another project in the same solution and compiling it to a static library" video.

  • @svenbtb
    @svenbtb 11 หลายเดือนก่อน +4

    I know I've probably already said this 100 times but thank you so much for all of your videos, they seriously help me so much. A lot of people who program aren't the best writers lol so it's really hard for me to follow along with most textbooks and written content from MIT, but watching you and hearing your clear explanations and SEEING how things work is so, so helpful, and makes it easier for me to code along with your examples (and pause the video to experiment if I have a "What if I do this?" moment) and to have it stick in my mind better

  • @Djzaamir
    @Djzaamir 6 ปีที่แล้ว +16

    Great stuff as always , and yes linking libs from source code video would be a nice add to this series

  • @Xwxwxx
    @Xwxwxx 6 ปีที่แล้ว +4

    The best playlist I've ever seen.. really detailed well.. keep up your videos and your way how to explain those complicated stuff really helpful.. thank mate

  • @seayellow5834
    @seayellow5834 ปีที่แล้ว

    A really great thing about your video is that you not only tell us what and why to do, but also conduct those little experiments that deepen our understanding. Well done.

  • @luisfernando262
    @luisfernando262 4 ปีที่แล้ว +2

    Amazingly detailed yet to the point. Thanks so much man

  • @zxnnightstalker2289
    @zxnnightstalker2289 3 ปีที่แล้ว +6

    nothing clear than that.
    the best c++ channel ever.
    I love the idea of explaining with eye contact.

  • @shvideo1
    @shvideo1 2 ปีที่แล้ว

    What a great video on this topic. Perfect explanation. Helps avoid a lot of pitfalls by understanding the steps. Thank you for sharing.

  • @jhfoleiss
    @jhfoleiss 3 ปีที่แล้ว +18

    Coming from a GNU background I always found Visual Studio projects confusing to setup. This video cleared a lot of my confusion about using external libraries. Thanks!

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว +1

      Yeah, dealing with IDEs is always such a mess... the syntax highlighting is nice though. I find things like Sublime to be a nice middle ground.

  • @tomaustin9166
    @tomaustin9166 ปีที่แล้ว +14

    Cherno, you are the only person that has made this make sense. You're an incredible teacher.

  • @nextlifeonearth
    @nextlifeonearth 6 ปีที่แล้ว +94

    1:37
    Windows wants to tell you something.

    • @tezza48
      @tezza48 5 ปีที่แล้ว +2

      no sound drivers, makes sense hehe

    • @jason-ps6mf
      @jason-ps6mf 5 ปีที่แล้ว +12

      I thought it was the sound of my computer :>)

    • @tezza48
      @tezza48 5 ปีที่แล้ว

      @Andrew Alfazy you didn't hear the ba dum tsss.

    • @ags0004
      @ags0004 5 ปีที่แล้ว +2

      @Andrew Alfazy in plain 2018 Linux still hasn't got stable NVida support

    • @michaelprantl1866
      @michaelprantl1866 5 ปีที่แล้ว

      You heard it too, hm?

  • @snuffbox2006
    @snuffbox2006 9 หลายเดือนก่อน

    great video. It often feels like so many other resources assume that one has this knowledge "a priori" and then you are stuck. You've shown that it is not that difficult, but one needs to learn it.

  • @anantj18
    @anantj18 4 ปีที่แล้ว +17

    Wow this is amazing!!! I spent more than 8 hours trying to create libraries using the GLFW source code and Cmake. This was so much simpler, and he actually explained how the linkers work. Kudos to you man !!!

    • @Tiogar60
      @Tiogar60 4 ปีที่แล้ว

      Anant Jain same ahaha

    • @mario_luis_dev
      @mario_luis_dev 2 ปีที่แล้ว

      you find this simpler than using CMake? You’re out of your mind

    • @anantj18
      @anantj18 2 ปีที่แล้ว

      @@mario_luis_dev No

  • @danieldrew2356
    @danieldrew2356 3 ปีที่แล้ว +9

    I've been going through this series one video at a time, and it feels so rewarding to finally be covering libraries!

  • @supersquare
    @supersquare 4 ปีที่แล้ว

    Thanks so much for this amazing walkthrough!

  • @aviandragon1390
    @aviandragon1390 5 ปีที่แล้ว

    Oh my god thank you so much. This is exactly what I needed. I'm not used to using visual studio and I just wanted to compile using a library from a third party. Hooray!

  • @siddharthkumar7561
    @siddharthkumar7561 4 ปีที่แล้ว

    First of, your videos are just the best I ever came across on C++ (atleast for me). And, love your long videos, please do more of in-depth. Learning a lot from you. Thanks

  • @collengura
    @collengura 2 ปีที่แล้ว

    Your videos are very good and well presented. You have changed my view about C++. Thank you.

  • @nathannlatimore7863
    @nathannlatimore7863 3 ปีที่แล้ว +4

    I really enjoyed this tutorial as always. However, I will say that I was pretty confused in the earlier parts of the video. I'd still consider myself kind of a beginner so when GLFW was brought up, I had to go on my own learning-tangent to find out what openGL and GLFW were.

  • @triangleangle
    @triangleangle 5 ปีที่แล้ว +4

    Dude ..you are a dude of cpp...love to see your videos..i hated cpp but whenever i feel that way i watch your videos...and my perspective changes..👍

  • @marcogallone_wosler
    @marcogallone_wosler ปีที่แล้ว

    This one saved me, I was stuck for 2 weeks with the same linking error, thanks Cherno

  • @alexandergonzalez5975
    @alexandergonzalez5975 6 ปีที่แล้ว

    I had to watch this video twice and read two articles to help, but now I fully understand thank you Cherno!

  • @jonathanpeters9271
    @jonathanpeters9271 5 ปีที่แล้ว +2

    I'm definitely interested in building the source code for dependent libraries! Please make that video!

  • @visintel
    @visintel 2 ปีที่แล้ว +3

    I think CMake videos would be super helpful for people on Linux and Mac. Thanks for the great content!

  • @logins
    @logins 6 ปีที่แล้ว

    A really useful video. Thank you Cherno!

  • @eyalpery8470
    @eyalpery8470 4 ปีที่แล้ว +3

    Very good video!
    For the Linux users -
    Static lib (".lib") is ".a" (Archive) in Linux and dynamic lib (".dll") is ".so" (Shared Object).

    • @theshermantanker7043
      @theshermantanker7043 2 ปีที่แล้ว

      For MacOS dynamic libraries have the .dylib extension btw

  • @h.hristov
    @h.hristov 6 ปีที่แล้ว +29

    Thank you for going in depth. I watch all your videos to the end.

  • @tljstewart
    @tljstewart 3 ปีที่แล้ว

    Love your videos brother!

  • @atle6913
    @atle6913 3 ปีที่แล้ว

    Thank you very much for this video, it's help me find the way out, so awesome man!!!

  • @andruha1067
    @andruha1067 3 ปีที่แล้ว

    You are awesome man. Was so confused about everything before watching this.

  • @ksawery6568
    @ksawery6568 4 ปีที่แล้ว

    Great explanation, thank you. Despite years of coding in different IDEs and languages, I always got confused how to setup C and C++ projects in Visual Studio.

    • @georgesealy4706
      @georgesealy4706 3 ปีที่แล้ว

      I used Visual Studio going way back into the early 1990s. No doubt, it is great in that it provides a lot of automation and help to get things done. It is the professional developer's choice for doing all kinds of projects. The thing is for beginners I would say using Eclipse is better because it is simpler and the developer has to understand what is actually going on.

  • @AttaKru
    @AttaKru 2 ปีที่แล้ว +1

    1:00 i completely agree, i also hate linking 3rd libraries, but be careful to distribute other source code within your project repo, it might just go against their end user agreement

  • @jimmylander2089
    @jimmylander2089 3 ปีที่แล้ว +1

    Nobody at university shows you this stuff. If I weren’t proactive in my studies I’d still be stuck writing cli programs. We’ve covered 3 languages and no one’s touched upon the topic of third party libraries. The closest we’ve gotten to an explanation was “just do ‘pip install’ and the manager will handle it” (python). No mention on basic stuff like having ‘requirements.txt’ or using virtual environments (especially on Linux).
    So in conclusion: Thanks for the awesome videos! Really helpful

  • @mcjustin1
    @mcjustin1 3 ปีที่แล้ว +2

    Man, this stuff is still confusing to me and I've had courses in C and C++. Thanks for the deep dives. I love it, and can't wait to start the Game Engine series.

  • @user-eg8me4hx5x
    @user-eg8me4hx5x 3 ปีที่แล้ว

    Apart from the quality of the video, the like is for the statement "you should have everything you need, straightaway, to compile and run"! That's always a big hustle with github projects!

  • @mikedoeren5960
    @mikedoeren5960 11 หลายเดือนก่อน

    Another great video. Now I finally know the difference between static and dynamic libraries, and don't have to scratch my head haha.
    Thanks!

  • @user-cb9nl1ek7p
    @user-cb9nl1ek7p 6 ปีที่แล้ว +1

    More linking coming soon in the OpenGL series I'm assuming with GLAD. Good vid, thanks!

  • @akashmodi7496
    @akashmodi7496 2 ปีที่แล้ว

    Loved the explanation

  • @ghostboxer5015
    @ghostboxer5015 4 ปีที่แล้ว

    I programmed in c# the last 4 years but I still got stuck trying to transition to C++.
    This video was clear and got me up and running. I wasted hours before I saw this and would have wasted more time if I hadn't seen this video.
    I'm going to put the cherno on my tool bar.

  • @romanzitlau3739
    @romanzitlau3739 5 ปีที่แล้ว

    Thanks a lot! You are so nice to listen to!

  • @medyassenoukil460
    @medyassenoukil460 ปีที่แล้ว

    Pretty cool videos that you made. The only issue is the resolution of your screen (very high), however if the internet speed is slow it is difficult to view them in HD.

  • @itsjustarainyday
    @itsjustarainyday ปีที่แล้ว

    He kept that notification at 1:38 for the trolol xD

  • @JauVi85
    @JauVi85 3 ปีที่แล้ว

    Goddamn I love you man :D best tutorial videos there are.

  • @Steven-tw7iz
    @Steven-tw7iz 6 ปีที่แล้ว +12

    Please make a video on building from source! I'd love to see how you approach it! Most people I use use cmake

  • @artinzareie4806
    @artinzareie4806 8 หลายเดือนก่อน

    Oh God after some years of confusion with C++ Libraries finally a video that worths it. God thanks

  • @worlordv
    @worlordv หลายเดือนก่อน

    Super good. Thanks.

  • @tooru
    @tooru 3 ปีที่แล้ว +5

    "I just want things y work" oh, a man of culture, I see

  • @be8059
    @be8059 6 ปีที่แล้ว

    Nice video, keep going! What is the brand of your watch???

  • @Erhanjinn
    @Erhanjinn 4 ปีที่แล้ว

    Thans for the video! Finally I have found a clear explanation!

  • @LKWPETER
    @LKWPETER 5 ปีที่แล้ว

    Very very good explanation!!!!

  • @warrenbuckley3267
    @warrenbuckley3267 5 ปีที่แล้ว

    Really enjoying your videos. One question I have is when would I use a .def to specify exported functions? Are .def files still needed today?

  • @Marcus-yc3ib
    @Marcus-yc3ib 2 หลายเดือนก่อน

    Thank you very much. It is very useful.

  • @_slier
    @_slier 3 ปีที่แล้ว +39

    this is the crap that hindering me from using c++ for years...i basically stuck with console apps...

    • @MrDe0
      @MrDe0 3 ปีที่แล้ว

      @@SJKKA GL 😂👌

    • @xyz8206
      @xyz8206 3 ปีที่แล้ว +3

      @@SJKKA use vs code, it is more transparent, you will learn a lot cuz you have to do it manually using .json files but it takes lot time. It took me 4 months.

    • @sleep3017
      @sleep3017 2 ปีที่แล้ว

      @@xyz8206 How do you do it with .json files. Can you link an article or something?

  • @Matematica_Aplicada
    @Matematica_Aplicada 6 ปีที่แล้ว

    Well done! Thank you!

  • @user-rm2gh2gc5f
    @user-rm2gh2gc5f 2 ปีที่แล้ว +1

    In lesson 49, I finally understood the movement of the hand at the end of the video, this is in order to give high five to Cherno through the monitor))

  • @giusepperandazzo5357
    @giusepperandazzo5357 2 ปีที่แล้ว

    very clear! thanks

  • @feraudyh
    @feraudyh 6 ปีที่แล้ว +14

    Hi Cherno (Bill?). When you get to dynamic libraries in a future video, could you point out the differences between *nix and Windows in this regard. In particular why Linux likes things like theshared.so, theshared.so.1 and perhaps even theshared.so.0.1. Oh and there's ldconfig (?).
    Keep up the great videos, you are very good at explaining things.

    • @smileynetsmileynet7922
      @smileynetsmileynet7922 3 ปีที่แล้ว +1

      Yes please. Please go over linux dynamic linking. And maybe also other dynamic linking, such as in your own os.

  • @93davve93
    @93davve93 6 ปีที่แล้ว

    Lookin' good Cherno!

  • @padelafterdark
    @padelafterdark 6 ปีที่แล้ว +1

    Please do a day in a life of your daily work routine at ea or something similar! That would be amazing. Thanks

  • @Villentrethenmerth
    @Villentrethenmerth 4 ปีที่แล้ว

    Watching this in 2020, but I believe this series will be around for many years to come.

  • @MecegguemMohamed
    @MecegguemMohamed 5 ปีที่แล้ว

    Thanks that's really help me understand c++

  • @longz2419
    @longz2419 6 ปีที่แล้ว

    Oh dude u make really good video

  • @georgesealy4706
    @georgesealy4706 3 ปีที่แล้ว

    Thanks for doing this video. I was a pretty good C/C++ developer back in the 1990s and very early 2000s. Then I started to do lots of C#, Java, Web Dev, and database development. So after all that time I forgot some of the detailed nuts and bolts of where things go to do C/C++. Oh yeah, I remember now, LOL. Incidentally, after doing all that stuff for many years, I still like C/C++ the best.

    • @theshermantanker7043
      @theshermantanker7043 2 ปีที่แล้ว

      For real. C/C++ and Java are pretty much the ancestors of programming today

  • @georgeclaphamholguin7087
    @georgeclaphamholguin7087 3 ปีที่แล้ว

    You are awesome man!

  • @zinovychannel3848
    @zinovychannel3848 2 ปีที่แล้ว

    thanks you helped me a lot

  • @kiranchowdary8100
    @kiranchowdary8100 4 หลายเดือนก่อน

    thank you for existing

  • @frootube5662
    @frootube5662 5 ปีที่แล้ว

    i love you thanks for clearing everything up for me

  • @JamesLimmer
    @JamesLimmer 4 ปีที่แล้ว

    Hi Mate, have watched a couple of your C++ videos. Very thorough. Though I'm running into trouble when trying to follow using Cross-Compile projects (Linux). When trying to set up a static library which cross-compiles along with multiple other C++ projects (Applications), I'm running into linking issues on the remote system. Do you think you can do a walkthrough using a remote linux machine for cross-compiling?

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      You're likely missing dynamic libraries on the remote system then that you are using in your build. The two main solutions are to either 1) install those dynamic libraries on the remote system and make sure they can be found (e.g. are in the environment's LD_LIBRARY_PATH

  • @wenbozhang3271
    @wenbozhang3271 3 ปีที่แล้ว

    very awesome video。why can’t my visual studio(2019) add the dependent path of lib and .h files? it must use the full path.

  • @christopherwilliams3293
    @christopherwilliams3293 ปีที่แล้ว +1

    You earned yourself a subscriber from me. Thank-you!

  • @dassumpfhuhn7225
    @dassumpfhuhn7225 6 ปีที่แล้ว +1

    How and can i dynamically get a class from, with LoadLibrary loaded, function?

  • @cesarmorelli8523
    @cesarmorelli8523 4 ปีที่แล้ว

    oh boi, helped me a lot, coding rust hack here. Using c++ and c#
    I've had the link2019 error, solved that, but with Xenos injector i got error, cause its an external .lib so i going try add this to project, thx a lot for this video explanation about this subject.

  • @visuallization
    @visuallization ปีที่แล้ว

    So good!

  • @serbastshexany7498
    @serbastshexany7498 4 ปีที่แล้ว

    Great video thxs

  • @BetaNegative
    @BetaNegative 2 ปีที่แล้ว +3

    I got these errors:
    · Warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    · Error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
    I managed to fix them going to *Properties > Linker > Input > Additional Dependencies* and adding
    · opengl32.lib

  • @TitusPeterson
    @TitusPeterson 6 ปีที่แล้ว

    Definitely want to hear about building libraries to link myself. I woul also like to hear about how the header files and linker work in the context of a binary. In your video on the linker, it worked very much hand-in-hand with the compiler, so if the compile step has already been completed for the binary, how does the linker know how to hook up both your binary and the already-compiled binary that you don't have the source for? Is there something in the header files that tells the linker what bits in the compiled binary correspond to which functions you would be calling out of it?

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      With symbols :P

  • @spicy_wizard
    @spicy_wizard 3 ปีที่แล้ว

    Love to see if there is a tutorial on how to compile source code for library, perhaps in cmake?

  • @lmnps1221
    @lmnps1221 2 ปีที่แล้ว

    so much thanks

  • @williambehrens1235
    @williambehrens1235 3 ปีที่แล้ว

    A video documenting how to do this on other platforms would be great, say something like cmake if you were to build from source

  • @funkynicco
    @funkynicco 6 ปีที่แล้ว +3

    Actually the version of visual studio a library was built with does matter because the binary may reference older SDK, linking to older libraries. And you might run into conflict issues when mixing different versions. It may work fine for some libraries like GLFW but it should in general case be discouraged. You'll know you're getting conflict errors in form of somewhat descriptive linker errors.
    If the library API is only passing primitive types (int, bool, etc) then there shouldn't be an SDK conflict but if you have a library taking in anything from STD/STL as parameters or return values then the memory layout may have been changed across SDK versions.
    Linux have bigger issues with binary compatibility model (linking to linux libraries) due to being updated so frequently, which is why the compile-it-yourself is so common on linux (apart from open source community).

    • @jordanstafford5110
      @jordanstafford5110 6 หลายเดือนก่อน

      Doesn’t work for glfw anymore, the glfw3.lib file isn’t static only anymore, apparently glfw3_mt.lib is the static build lib now

  • @ramendude4062
    @ramendude4062 ปีที่แล้ว +2

    hello, I am enjoying your tutorials, but at 12:10 the include is showing me an error saying "cannot open source file GLFW/glf3.h" any help would be appreciated. the compiler error is C:\Users\Name\Desktop\CppDev\projects\ProjectSol\Project1\test.cpp(5,9): fatal error C1083: Cannot open include file: 'GLFW/glfw3.h>': No such file or directory

  • @zvxcvxcz
    @zvxcvxcz 4 ปีที่แล้ว +1

    +The Cherno Well... there are reasons to use dynamic, including for security (update the lib in one place and the security patches will be there for everything linking it), and you also get reduced disk space usage overall for the system with this reuse. There are also some double edged swords. A bad update can break lots of code depending on it (experienced this on Arch Linux... bleeding edge indeed). I also sometimes deal with code with very specific dependencies and it is not fun hunting them all down to build a precise environment for ten different apps requiring three different Java versions... that's just gross and my life would be way easier if they statically linked their code. This is why for my own stuff I provide both static and dynamically linked versions (when possible, sometimes I have a dependency that doesn't build statically).

    • @talkysassis
      @talkysassis ปีที่แล้ว

      This is a simple problem to solve.
      The Operating System is a base runtime that can run your programs. Every system package MUST be a closed circle, not linked to layers above, only below.
      The user programs can use the system runtime libraries with dynamic linking, as the developer knows that the system WILL provide those libs in the correct version and location.
      Every other lib that a program use that's not on the system runtime MUST be provided with the program, and used statically (even if using dynamic files) to avoid depending on the system repositories.
      The system this way have a mission. Provide a SDK to build programs to run on it, and keep runtime compatibility with older versions, in a gap that can keep programs running at least for 10 years without recompiling.
      This seems complicated, but actually is the simplest good way (not the simplest way ever) to do things.
      Another more complex solution is to separate the system and the programs as two runtimes, and create symbolic links to specific lib versions that the programs need. If a program want x-1.0 then you instal x-1.0, but if another program wants x-1.6 then you install x-1.6, but as your programs will be looking for the same x lib, you create a symlink to the correct version that the program needs. This comes with the cost of keeping every single release of that lib on the repos, but as programs tend to use the latest version, the system can share a lot of code without breaking programs when updating.

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      @@talkysassis " the developer knows that the system WILL provide those libs in the correct version and location."

    • @talkysassis
      @talkysassis ปีที่แล้ว

      ​@@zvxcvxcz All of this only applies to servers. Windows, OSX ans Android have their stable runtimes.
      You know what the runtime have. They don't break it on every new release.

  • @l6e6i6n
    @l6e6i6n 3 ปีที่แล้ว

    very nice explanation i understood everything

  • @a740g
    @a740g ปีที่แล้ว

    I've started liking nuget packages in VS since it now supports native libraries.

  • @elimenendez237
    @elimenendez237 6 ปีที่แล้ว

    Thank You!

  • @dabhibrijesh6835
    @dabhibrijesh6835 4 หลายเดือนก่อน

    very useful sir

  • @piotrlenarczyk5803
    @piotrlenarczyk5803 3 ปีที่แล้ว

    Thank you for video.

  • @JuWnL
    @JuWnL 4 ปีที่แล้ว

    Thank you!!!

  •  6 ปีที่แล้ว +1

    do you know vcpkg? package manager made by microsoft for c++ . I think you should introduce it. I am using and it is very useful.

  • @pwlegolas3
    @pwlegolas3 3 ปีที่แล้ว

    Very interesting video... Cherno !!

  • @jhoc9157
    @jhoc9157 3 ปีที่แล้ว

    thank you very much

  • @liuwendong9223
    @liuwendong9223 ปีที่แล้ว

    Hi Cherno, which library do you suggest that could do 3D (by x,y,z coordinates )interpolation?

  • @zvxcvxcz
    @zvxcvxcz ปีที่แล้ว

    Hmm, this is mostly covering using a static library, but not to build your code statically. All sorts of fun issues one can run into there. Was just trying to static compile my program recently with GLEW and had -lGL in my g++ line... lol, of course that didn't work. And so I learned how to get g++ to compile just some dependencies manually (using '-Wl,' before the libraries you can to apply an option to and having that option be -Bstatic and -Bdynamic respectively. Like: g++ myprogram.cpp -o MyProgram -I someFolder -L somelibFolder -L someotherlibFolder -Wl,-Bstatic -lsomestaticlib -Wl,Bdynamic -lsomedynamiclib For those that aren't aware -lGL is provided by the GPU driver... so it's not going to be static or portable.
    Some other things that aren't static build friendly: dlopen(), a lot of network libraries, e.g. curl.

  • @valizeth4073
    @valizeth4073 5 ปีที่แล้ว

    Hey Cherno. I've recently made myself an opengl library that makes you write less repeating code. Currently I have the class specifications in the library's .h file and the class implementation in the .lib file. Is that the correct way of doing it, if not, how?

  • @cepi24
    @cepi24 5 ปีที่แล้ว

    Please which video (about name mangling etc.) are you referring at 16:30? Thanks

  • @jostein6581
    @jostein6581 6 ปีที่แล้ว

    Great video! What about the DLL file when running the compiled code? I usually add a post-script in VS and copy the DLL(s) to the output folder. Do have to keep in mind of which folder the executable is run from.

    • @TheCherno
      @TheCherno  6 ปีที่แล้ว

      +Jostein Topland not applicable for this because we’re linking statically, there is no dll.

    • @jostein6581
      @jostein6581 6 ปีที่แล้ว

      Yeah. I was thinking about dynamic linking. How do you deal with dependency DLLs in VS for that?

    • @TheCherno
      @TheCherno  6 ปีที่แล้ว +1

      +Jostein Topland I try to deal with static libs whenever possible, but otherwise a post-build step to copy the dll is usually the way to go. You can use macros to make sure it ends up in the right place of course.

    • @jostein6581
      @jostein6581 6 ปีที่แล้ว

      Sounds good. Due to the SDL 1.x LGPL license, linking has to be done dynamically, except if you include the SDL source code. For SDL2 zlib licence, static linking without including the SDL2 source code is fine. However, I see SDL2 projects still use dynamic linking. Do you have any opinions on dynamic vs static linking with SDL2?

    • @TheCherno
      @TheCherno  6 ปีที่แล้ว +1

      Dynamic linking is fine, although there are other libraries (such as GLFW) which may be better suited depending on your needs, since SDL is a little heavy. As for SDL2, 100% static link. There's no benefit to dynamic linking.