Installation, compiled muduo, use muduo
Download, install compilation process muduo Click https://blog.csdn.net/YoungSusie/article/details/90021742
In this paper, Chen Shuo teacher gitOn the site muduo-tutorial-master programMuduo example to explain how to use the library, and which may encounter problems and solutions.
1, a sample package download
Download https://github.com/chenshuo/muduo-tutorial
Decompression, Chen Shuo teacher in the README inside very clearly written, this small program there are ways to compile and run four kinds, here I chooseThe fourth build with GNU make Compile, run.
2, the first set paths, and library file path
- The compiled / Desktop / build / release-install-cpp11 / include / folder muduo folder usr / down to copy / include
# cp /Desktop/build/release-install-cpp11/include/muduo /usr/include (这里前面的文件夹为muduo被编译到的文件夹)
- The compiled / Desktop / build / release-install-cpp11 / lib / folderFour libFolder (libmuduo_base.a libmuduo_net.a libmuduo_http.a libmuduo_inspect.a) copied to under / usr / lib
Modify the MakefilePath setting, andModify / src folder echo.cc fileContents include part. Otherwise it will complain that the problem muduo libraries, and can not find the name space can not be found.
(1) modify the contents of the Makefile, the step shown in FIG.First of allDirectory is set before the statement commented,NextSetting up a new directory.
Behind the content include (2) modifying the source code. The later include "" all changed <>, Baidu own reasons. "" And <> the difference between the latter include.
-
Switch to
cd ./muduo-tutorial/makefile
, thenmake
given:error: #Error This file requires compiler and library support for the ISO C ++ 2011 standard.
The problem is that is should c11, open the folder ./muduo-tutorial/makefileMakefileFile is modified.
Add the contents inside the red box to the Makefile inside. -
Modify the Makefile in a total of three places.
Next in muduo-tutorial / makefile, run the commandmake
successfully compiled in this directory created under the echo.o executable file, run the file.
to sum up
For download the source code, you must pay attention makefile inside your own path and whether the same system inside. Second source files include the following "" replace it with <>.
Compilation errors encountered, from the very beginning where an error has occurred, carefully read the error and correct the error.