安装MinGW-C++开发环境2--软件安装
1、解压x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z到C:\Local\MinGW64
2、拷贝bin\mingw32-make.exe到bin\make.exe
3、解压cmake-3.19.0-win64-x64.zip,拷贝bin目录下的所有exe文件到C:\Local\MinGW64\bin目录下。
4、解压ninja-win.zip,拷贝解压出的ninja.exe到C:\Local\MinGW64\bin目录下。
5、新建MinGW.bat批处理文件,写入下面内容并放在C:\Local\MinGW64目录下执行:
@echo off if not exist "%~dp0bin\gcc.exe" goto retfail1 title "MinGW" if "%X_DISTRO%" == "MinGW" goto :eof set X_DISTRO=MinGW set PATH=%~dp0bin;%PATH% set X_MEOW=%~dp0include set C_INCLUDE_PATH=%X_MEOW%;%C_INCLUDE_PATH% set CPLUS_INCLUDE_PATH=%X_MEOW%;%CPLUS_INCLUDE_PATH% set X_MEOW= goto :eof :retfail1 set X_ERR1=ERROR: You must run %~nx0 from the root of the distro. set X_ERR2= Don't copy or move this batch file. set X_ERR3= However. it's okay to create a shortcut to this batch file. cmd /t:4f /k "echo %X_ERR1% && echo %X_ERR2% && echo %X_ERR3% && title ERROR" goto :eof
6、在C:\Local\MinGW64下创建software目录,将googletest-release-1.10.0.zip和huawei_secure_c.zip解压放在该目录下。
7、进入C:\Local\MinGW64\software\googletest-release-1.10.0,创建build目录并进入,依次执行下面的指令进行编译安装googletest:
C:\Local\MinGW64\software\googletest-release-1.10.0>mkdir build C:\Local\MinGW64\software\googletest-release-1.10.0>cd build C:\Local\MinGW64\software\googletest-release-1.10.0\build>cmake -DCMAKE_INSTALL_PREFIX="C:\Local\MinGW64" -G "MinGW Makefiles" .. C:\Local\MinGW64\software\googletest-release-1.10.0\build>make C:\Local\MinGW64\software\googletest-release-1.10.0\build>make install
8、进入C:\Local\MinGW64\software\huawei_secure_c\src目录下,执行下面指令编译huawei_secure_c:
C:\Local\MinGW64\software\huawei_secure_c\src>set CC=gcc C:\Local\MinGW64\software\huawei_secure_c\src>make lib C:\Local\MinGW64\software\huawei_secure_c\src>
由于没有安装命令,需要将C:\Local\MinGW64\software\huawei_secure_c目录下的include和src目录拷贝到C:\Local\MinGW64目录下。