C++ Library Include

2019-02-19 15:02发布

I am relatively new to C++ and need to use a library for the first time. I was hoping someone would be able to show me how to properly [ link to / include ] the library.

The library I want to use is the ID3 v3.8.8 that can be found here: http://id3lib.sourceforge.net/

I have downloaded the Windows binaries and now just need a way to link to the library.

Files downloaded: Debug/id3lib.dll, Debug/id3lib.lib, Debug/id3lib.exp, Release/id3lib.dll, Release/id3lib.lib, Release/id3lib.exp

I am using Visual Studio 2010.

Any help is greatly appreciated. Thanks in advance.

3条回答
来,给爷笑一个
2楼-- · 2019-02-19 15:43

Add id3lib.lib to your project, that should satisfy the linker and the resulting executable will depend on id3lib.dll.

查看更多
Evening l夕情丶
3楼-- · 2019-02-19 15:44

Before you can do any C++ development with this library you'll need the headers too which are in the id3lib-3.8.3.zip file. You have only downloaded the binaries which will let you run an application that needs those libraries but not re-compile it.

查看更多
相关推荐>>
4楼-- · 2019-02-19 15:52

There are several steps, and many a pitfall. If you are a rank newbie at using C++ and VC++ in particular, every step is going to require some (gasp) reading of documentation or googling.

  • In VC++ 2010, use the Property Manager "C/C++ General / Additional Include Directories" section if necessary to tell the compiler how to find the header-files.
  • Use the Property Manager "C/C++/ Code Generation / Runtime Library" section if necessary to tell the compiler what version of the Microsoft C Runtime Library the library requires.
  • Use Property Manager "Linker / Input / Additional Dependencies " to specify the .lib file id3lib.lib.
  • Use Property Manager "Linker / General / Additional Library Directories" to tell the linker where to find .lib file.
  • If the dll id3lib.dll is not in the directory where you will start your program, open a Microsoft Explorer window, and right-click on "My Computer." Select "Properties/Advanced/Environment Variables", and edit the user-variable PATH to contain the path of the directory that contains the dll. Be very careful doing this. Before you change it, copy the value that's there originally and save it to a text file, in case you mess up and need to restore it. If you get it wrong, other programs can fail to start.

Good luck.

查看更多
登录 后发表回答