[fix] openssl No such file or directory error C++

myProg.cpp:32:21: error: openssl/bio.h: No such file or directory
myProg.cpp:34:21: error: openssl/des.h: No such file or directory
myProg.cpp:36:21: error: openssl/pem.h: No such file or directory
myProg.cpp:37:21: error: openssl/rsa.h: No such file or directory

If you are trying to run C++ code that makes use of OpenSSL libraries on Ubuntu and you get the above errors, then you need to install the OpenSSL libssl-dev development package.

Command: apt-get install libssl-dev

# sudo apt-get install libssl-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 19 not upgraded.
Need to get 1462 kB of archives.
After this operation, 7597 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 libssl-dev arm64 1.1.1f-1ubuntu2.12 [1462 kB]
Fetched 1462 kB in 2s (876 kB/s)      
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libssl-dev:arm64.
(Reading database ... 20245 files and directories currently installed.)
Preparing to unpack .../libssl-dev_1.1.1f-1ubuntu2.12_arm64.deb ...
Unpacking libssl-dev:arm64 (1.1.1f-1ubuntu2.12) ...
Setting up libssl-dev:arm64 (1.1.1f-1ubuntu2.12) ...

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.