How to “add reference” in C++

前端 未结 4 848
不思量自难忘°
不思量自难忘° 2021-02-07 10:53

I\'m new to C++ and there\'s something I just completely don\'t get. In C#, if I want to use an external library, log4net for example, I just add a reference to the log4net DLL

4条回答
  •  甜味超标
    2021-02-07 11:13

    C++ doesn't have libraries in the sense you're thinking of. It has header files that you #include, and it has things called libraries that the linker deals with, which contain the compiled code. You need to add the libraries (.LIB files) to the linker settings.

    On Windows if you're using a DLL, ideally you should have a .LIB file to go with it that is called the Import Library for the DLL, and you add that .LIB file to your linker settings.

提交回复
热议问题