Search code examples
c++codeblockslibrarieshashlib

"No such file or directory" error for hashlib++ library in CodeBlocks


I am coding a project in C++ in CodeBlocks, and I am trying to use the hashlib++ library, and I have it in my code as such:

#include <hashlibpp.h>

When I click "build and run", on that line of code I get the following error:

fatal error: hashlibpp.h: No such file or directory

I have the entire hashlib++ library in the same directory as my main.cpp file.

I was following the instructions on the documentation at http://hashlib2plus.sourceforge.net/doc/README.TXT.html but either the instructions in sections 3.1 and 3.2 did not work or I did not follow them properly.

I would appreciate any insight as to why I am getting this error.


Solution

  • Ok, so I figured out what the issue was. By section 3.1,

    1. Go to your project in the "Management" tab, and right-click the project you are working on. If you cannot see that section go to View > Manager, or press Shift + F2.
    2. After right-clicking, select "add files..." and simply find and add the .h file you will be using. After it should show up in the "Management" section in a folder called "Headers".
    3. Type in appropriate #include line in your code. I downloaded the entire hashlib2plus folder and put it in my project folder, so mine looked like
      #include "hashlib2plus/trunk/src/hashlibpp.h"

    Hope this resolves any issues in the future!