2016-04-23 116 views
0

我在C++裏做了一個TCP套接字程序,使用wsock32openssl,但是我想鏈接openssl static。undefined reference C++ mingw32

我編譯opensslmingw32共享和不共享,但我一直收到相同的未定義的參考錯誤。

如果我連接.a.dll而不是.a,它會生成很好,但我不想使用dll。

以下是我編譯:

/c/MinGW/bin/mingw32-g++.exe main.cpp -I /c/Mingw-builds/openssl/include -L/c/MinGW/lib -L /c/Mingw-builds/openssl/lib -std=c++11 -lwsock32 -lshlwapi -lws2_32 -lssl -lcrypto -lgdi32 

錯誤,我得到:

C:/Mingw-builds/openssl/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0xac): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0x6ef): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0xa28): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0xe6): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x2d6): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x40b): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x43b): undefined reference to `[email protected]' 
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x4a0): undefined reference to `[email protected]' 

回答

0

NVM得到它的工作通過命令的權利:

/c/MinGW/bin/mingw32-g++.exe main.cpp -o asdf.o -I /c/Mingw-builds/openssl/include -L /c/Mingw-builds/openssl/lib -std=c++11 -lmingw32 -lssl -lcrypto -luser32 -lgdi32 -lws2_32 -lwsock32 -lshlwapi -static-libgcc -static-libstdc++ -shared 
+0

請訪問http://計算器。 COM /問題/ 3363398 /克聯階依賴性-當聯-C-碼到C代碼。 – Holt