[Solved] ffmpeg Error: fatal error: zlib.h: Not having that file or directory

Environmental Science:

Ubuntu18. 04×86-64

Error phenomenon:

When compiling ffmpeg code, the following errors sometimes occur:

libavformat/http.c:25:10: fatal error: zlib.h: Not having that file or directory
 #include <zlib.h>


Enter the following on the command line

sudo apt-get install zlib1g-dev

Press enter to execute, and the following output appears:

Reading the package list... Done
Analyzing the dependency tree of the package       
Reading status information... Done       
The following [new] packages will be installed.
0 packages upgraded, 1 new package installed, 0 packages to uninstall, and 316 packages not upgraded.
176 kB of archives need to be downloaded.
Unpacking will consume 457 kB of additional space.
Get:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-0ubuntu2 [176 kB]
Downloaded 176 kB in 2 seconds (82.2 kB/s)  
Unselected package zlib1g-dev:amd64 is being selected.
(Database is being read ... The system currently has 149705 files and directories installed.)
Preparing to unpack ... /zlib1g-dev_1%3a1.2.11.dfsg-0ubuntu2_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) ...
Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) ...
Working on triggers for man-db (2.8.3-2ubuntu0.1) ...

Problem solving

Read More: