1 下载openssl安装包并安装
下载网址: https://slproweb.com/products/Win32OpenSSL.html
 下载对应的安装版本。
 
双击安装包,一路下一步完成安装。注意:1.安装路径不要有空格; 2. 建议不要把DLL拷贝到系统路径。
 

2 编辑代码
#include <stdio.h>
#include <stdint.h>
#include "openssl/x509.h"
int32_t main(void)
{
	printf("Hello World\n");
	X509 *root_cert = X509_new();
	return 0;
}
 
3 编译
gcc main.c -LD:/Software/OpenSSL_Win64/bin -ID:/Software/OpenSSL_Win64/include -lcrypto-3-x64
 
注意windows下不同的终端路径里面的斜杠写法可能不一样,cmd使用反斜杠,gitbash使用正斜杠。

















