Visual Studio: How to use libraries in C++ project

thebluetropics 1,046 Reputation points
2022-10-18T11:21:08.663+00:00

I was building a Win32 project that depends on this hashing library.

What I've tried:

  • I created an include folder inside the project, and then put sha256.h and sha256.cpp to the folder.
  • Add the include folder to the Additional Include Libraries

When I build the project, it throws me build errors like LNK2019 and LNK1120...

This said, I've build and run the program successfully under these condition:

  • I included all files under include folder to the project/solution

As far as I know, we don't include library files to the project...

How can I build the project without including all library files inside include folder?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 questions
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,637 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
967 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 43,381 Reputation points
    2022-10-18T11:51:54.123+00:00

    According to the library's author "Since there are no external dependencies, not even dependencies within the library itself, all you need is to include the header of the hashing algorithm of your choice and add the identically named .cpp to your project. That means if you want to add SHA256 hashing to your C++ program, you only have to include sha256.h and sha256.cpp in your project.
    "


0 additional answers

Sort by: Most helpful