Library definition

kaveh rahimi 61 Reputation points
2021-09-09T13:27:38.727+00:00

Hi , I want to add a library to my project (the library is 'CH341DLL.LIB') and don't know which sort of file extension have I to use and how and where can I add it?
Please explain by example
Thanks

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,625 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sam of Simple Samples 5,526 Reputation points
    2021-09-10T01:33:38.087+00:00
    0 comments No comments

  2. WayneAKing 4,921 Reputation points
    2021-09-10T02:32:02.04+00:00

    I want to add a library to my project (the library is
    'CH341DLL.LIB') and don't know which sort of file
    extension have I to use

    What do you mean? You use the file extension that is
    already part of the file name: .lib

    and how and where can I add it?

    A lib file is used by the Linker. There are a few
    different ways to tell the Linker what to use and
    where to find it.

    (1) As you were shown in your other thread you can use
    a pragma statement at the start of your source file:

    #pragma comment(lib, "CH341DLL.LIB")
    

    This assumes that you have specified the directory where
    the lib is to be found in the Linker project properties
    as an Additional Library Directory.

    (2) Another way is via the Linker Input properties for the
    project as an Additional Dependency, where you add the file
    name to the list already generated. This also requires that
    the Additional Library Directories property has had the
    location of the .lib added.

    • Wayne