转自:https://blog.csdn.net/qq_39436605/article/details/81325975 
作者:我是小超斌 

使用linux带的openss 出现没找到aes.h里面的几个函数,是因为需要我们自己添加需要的库

添加库和头文件的方法有

 hello hello.c -I /home/hello/include -L /home/hello/lib -lworld
上面这句表示在编译hello.c时:

  • -I /home/hello/include表示将/home/hello/include目录作为第一个寻找头文件的目录,寻找的顺序是:/home/hello/include-->/usr/include-->/usr/local/include
  • -L /home/hello/lib表示将/home/hello/lib目录作为第一个寻找库文件的目录,寻找的顺序是:/home/hello/lib-->/lib-->/usr/lib-->/usr/local/lib
  •  -lworld表示在上面的lib的路径中寻找libworld.so动态库文件(如果gcc编译选项中加入了“-static”表示寻找libworld.a静态库文件)

使用OpenSSL 的AES加密报错undefined reference to `AES_set_encrypt_key'-LMLPHP

只需要

gcc main.c -lssl -lcrypto    就可以了。

09-24 01:32
查看更多