下载libqrencode源码编译过程
git clone https://github.com/fukuchi/libqrencode.git
2001 mkdir build
2002 cd build/
2004 cmake ..
2009 make
2027 sudo make installz
2029 cd ~
2030 qrencode -o test.png nihao
2037 sudo apt-get install ccmake
2038 sudo apt-get install cmake-curses-gui
(修改build目录下的CMakeCache.txt文件如下://Enable build of shared libraries BUILD_SHARED_LIBS:BOOL=ON)
2043 cd build/
2045 ccmake ..
2046 make
2047 sudo make install
-------------------------------------------------------------------------------
wang@wang:~/libqrencode/build$ make
Scanning dependencies of target qrencode
[ 10%] Building C object CMakeFiles/qrencode.dir/qrencode.c.o
[ 20%] Building C object CMakeFiles/qrencode.dir/qrinput.c.o
[ 30%] Building C object CMakeFiles/qrencode.dir/bitstream.c.o
[ 40%] Building C object CMakeFiles/qrencode.dir/qrspec.c.o
[ 50%] Building C object CMakeFiles/qrencode.dir/rsecc.c.o
[ 60%] Building C object CMakeFiles/qrencode.dir/split.c.o
[ 70%] Building C object CMakeFiles/qrencode.dir/mask.c.o
[ 80%] Building C object CMakeFiles/qrencode.dir/mqrspec.c.o
[ 90%] Building C object CMakeFiles/qrencode.dir/mmask.c.o
Linking C static library libqrencode.a
[ 90%] Built target qrencode
Scanning dependencies of target qrenc
[100%] Building C object CMakeFiles/qrenc.dir/qrenc.c.o
Linking C executable qrencode
[100%] Built target qrenc
-------
wang@wang:~/libqrencode/build$ make
[ 10%] Building C object CMakeFiles/qrencode.dir/qrencode.c.o
[ 20%] Building C object CMakeFiles/qrencode.dir/qrinput.c.o
[ 30%] Building C object CMakeFiles/qrencode.dir/bitstream.c.o
[ 40%] Building C object CMakeFiles/qrencode.dir/qrspec.c.o
[ 50%] Building C object CMakeFiles/qrencode.dir/rsecc.c.o
[ 60%] Building C object CMakeFiles/qrencode.dir/split.c.o
[ 70%] Building C object CMakeFiles/qrencode.dir/mask.c.o
[ 80%] Building C object CMakeFiles/qrencode.dir/mqrspec.c.o
[ 90%] Building C object CMakeFiles/qrencode.dir/mmask.c.o
Linking C shared library libqrencode.so
[ 90%] Built target qrencode
Linking C executable qrencode
[100%] Built target qrenc
----------------------------------------------------------------------------
wang@wang:~/libqrencode/build$ make
[ 90%] Built target qrencode
[100%] Built target qrenc
-----------------------------------------------------------------------------
wang@wang:~/libqrencode/build$ sudo make install
[sudo] password for wang:
[ 90%] Built target qrencode
[100%] Built target qrenc
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/qrencode
-- Installing: /usr/local/share/man/man1/qrencode.1
-----------------
wang@wang:~/libqrencode/build$ sudo make install
[ 90%] Built target qrencode
[100%] Built target qrenc
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/qrencode
-- Removed runtime path from "/usr/local/bin/qrencode"
-- Up-to-date: /usr/local/share/man/man1/qrencode.1
-- Installing: /usr/local/lib/pkgconfig/libqrencode.pc
-- Installing: /usr/local/lib/libqrencode.so
-- Installing: /usr/local/include/qrencode.h
-------------------------------------------------------------------------
This compiles and installs the library and header file to the appropriate directories. By default, /usr/local/lib and /usr/local/include.
You can change the destination directory by passing some options to the configure script. Run "./configure --help" to see the list of options.
It also installs a binary "qrencode" to /usr/local/bin. If you want not to install it, give "--without-tools" option to the configure script.
库:/usr/local/lib
头文件:/usr/local/include
二进制可执行文件:/usr/local/bin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
一,源码获取:
1.可使用本文件夹中的libqrencode-master.zip
2.也可自行下载:git clone https://github.com/fukuchi/libqrencode.git
二,编译与安装
1.解压libqrencode-master.zip会生成libqrencode-master文件
2.打开一个终端,进入libqrencode-master文件路径(cd xxxx/libqrencode-master)
3.mkdir build
4.cd build/
5.将CMakeLists.txt的CMAKE_MINIMUM_REQUIRED改为3.0.2
6.cmake ..
7.make
8.sudo make install
9.sudo apt-get install cmake-curses-gui
10.ccmake ..
在弹出的编辑界面将 BUILD_SHARED_LIBS:BOOL=OFF改为 BUILD_SHARED_LIBS:BOOL=ON
11.make
12.sudo make install
三,直接生成二维码图片
1.在终端执行:qrencode -o test.png nihao会生成名为test.png的二维码图片
2.扫描该二维码图片,其内容为“nihao”