C++ 未定义对“执行副总裁”的引用;
我在构建程序时遇到了一个问题 我使用从git源代码安装opensslC++ 未定义对“执行副总裁”的引用;,c++,makefile,openssl,linker,C++,Makefile,Openssl,Linker,我在构建程序时遇到了一个问题 我使用从git源代码安装openssl ./config make sudo make install 它在/usr/local/ssl中创建了目录,然后我在Makefile中使用了: all: amalgam clean security.o: security.cpp g++ $< -I/usr/local/ssl/include -c -o $@ -L/usr/local/ssl/lib -lssl -lcrypto amalgam.o
./config
make
sudo make install
它在/usr/local/ssl中创建了目录,然后我在Makefile中使用了:
all: amalgam clean
security.o: security.cpp
g++ $< -I/usr/local/ssl/include -c -o $@ -L/usr/local/ssl/lib -lssl -lcrypto
amalgam.o: amalgam.cpp
g++ $< -c -o $@
amalgam: security.o amalgam.o
g++ $^ -o $@
clean:
-rm *.o
汞合金
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <fstream>
#include "security.h"
using namespace std;
int main (int argc, char ** argv){
amal_sec new_sec;
new_sec.genkey();
}
任何帮助都将不胜感激 你就快到了。在makefile中,需要将
-L/usr/local/ssl/lib-lssl-lcrypto
添加到amalgam
规则中的链接器命令行,以指定要链接的附加库,而不是security.o
规则的编译器命令行。。这解决了我的问题。非常感谢。
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <fstream>
#include "security.h"
using namespace std;
int main (int argc, char ** argv){
amal_sec new_sec;
new_sec.genkey();
}
#include <openssl/evp.h>
#include <openssl/rsa.h>
class amal_sec
{
public:
bool genkey();
};
#include "security.h"
bool amal_sec::genkey(){
printf("Generating a Key\n");
EVP_PKEY_CTX *ctx;
EVP_PKEY *pkey = NULL;
ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
}