使用VS2015編譯openssl1 0 1p

2021-09-30 12:27:19 字數 1331 閱讀 5210

使用vs2015編譯openssl1.0.1p會碰到如下錯誤

檢視**檔案e_os.h 318行存在如下定義

#    if _msc_ver>=1300

#     undef stdin

#     undef stdout

#     undef stderr

file *__iob_func();

#     define stdin  (&__iob_func()[0])

#     define stdout (&__iob_func()[1])

#     define stderr (&__iob_func()[2])

#    elif defined(i_can_live_with_lnk4049)

而__iob_func在vs2015沒有了。

實際上vs已經定義了巨集stdin,stdio,stderr,直接使用vs定義也是可以的。

vs2015中對stdin,stdio,stderr的定義如下:

_acrtimp_alt file* __cdecl __acrt_iob_func(unsigned);

#define stdin (__acrt_iob_func(0))

#define stdout (__acrt_iob_func(1))

#define stderr (__acrt_iob_func(2))

為了保持openssl**的一致,修改e_os.h 318**如下:

#    if _msc_ver>=1900

#     undef stdin

#     undef stdout

#     undef stderr

file*  __acrt_iob_func(unsigned);

#     define stdin  (__acrt_iob_func(0))

#     define stdout (__acrt_iob_func(1))

#     define stderr (__acrt_iob_func(2))

#    elif _msc_ver>=1300 && _msc_ver<1900

#     undef stdin

#     undef stdout

#     undef stderr

或者直接使用vs對巨集的定義

#    if _msc_ver>=1300 && _msc_ver<1900

#     undef stdin

#     undef stdout

#     undef stderr

編譯通過。



關於使用VS2015靜態編譯

首先必須搞清楚專案 專案屬性 配置屬性 c c 生成 執行庫中四個選項的關係 多執行緒除錯dll mdd 對應 md dynamicdebug 多執行緒dll md 對應 md dynamicrelease 多執行緒 mt 對應 md staticrelease 多執行緒 mtd 對應 md sta...

VS2015靜態編譯設定

首先必須搞清楚專案 專案屬性 配置屬性 c c 生成 執行庫中四個選項的關係 多執行緒除錯dll mdd 對應 md dynamicdebug 多執行緒dll md 對應 md dynamicrelease 多執行緒 mt 對應 md staticrelease 多執行緒 mtd 對應 md sta...

vs2015編譯dlib,測試

dlib vs2015編譯 測試 使用cmake生成文件 使用vs2015編譯,成功,靜態庫 使用demo測試 include stdafx.h include dlib image processing frontal face detector.h include dlib image io.h...