1. 程式人生 > >openssl程式設計出現no OPENSSL_Applink

openssl程式設計出現no OPENSSL_Applink

錯誤現象:

直接執行列印以下錯誤:

OPENSSL_Uplink(10111000,08): no OPENSSL_Applink

除錯,問題出在:PEM_write_RSAPublicKey 這個函式上,除錯資訊如下:

'PSCS7+SIGN.exe' (Win32): Loaded 'F:\code\PSCS7+SIGN\Debug\PSCS7+SIGN.exe'. Symbols loaded.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\libeay32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\lpk.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\usp10.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\msvcr90.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\msvcr110d.dll'. Symbols loaded.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\netapi32.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\netutils.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\srvcli.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\wkscli.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Unloaded 'C:\Windows\System32\netapi32.dll'
'PSCS7+SIGN.exe' (Win32): Unloaded 'C:\Windows\System32\wkscli.dll'
'PSCS7+SIGN.exe' (Win32): Unloaded 'C:\Windows\System32\srvcli.dll'
'PSCS7+SIGN.exe' (Win32): Unloaded 'C:\Windows\System32\netutils.dll'
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\rsaenh.dll'. Cannot find or open the PDB file.
'PSCS7+SIGN.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Cannot find or open the PDB file.
The thread 0x1d3c has exited with code 1 (0x1).
The thread 0x1d64 has exited with code 1 (0x1).
The program '[7480] PSCS7+SIGN.exe' has exited with code 1 (0x1).

解決方法:

在main檔案中加入OpenSSL的連結標頭檔案

extern "C"{
#include "openssl/applink.c"
};