未定义的引用 C++ MingW32
undefined reference c++ mingw32
我在C++
中制作了一个使用wsock32
和openssl
的TCP套接字程序,但我想openssl
静态链接。
我已经在共享和不共享的mingw32
上编译了openssl
,但我不断收到相同的未定义的引用错误。
如果我链接.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 `getnameinfo@28'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0x6ef): undefined reference to `freeaddrinfo@4'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0xa28): undefined reference to `getaddrinfo@16'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0xe6): undefined reference to `WSAGetLastError@0'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x2d6): undefined reference to `WSAGetLastError@0'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x40b): undefined reference to `getsockopt@20'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x43b): undefined reference to `gethostbyname@4'
C:/Mingw-builds/openssl/lib/libcrypto.a(b_sock.o):b_sock.c:(.text+0x4a0): undefined reference to `WSAGetLastError@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
相关文章:
- Mingw32无法静态链接到libgcc_s_dw2-1、libstdc++-6、libwinpthread-1(Qt
- mingw32-make 使用"MinGW Makefiles"生成器跟踪 CMAKE 无法将可执行文件链接到对象库
- mingw32_gt_pch_use_address中的内部错误,在config/i386/host-mingw32.c
- 使用 x86_64-w64-mingw32-g++ 编译 JNI C++本机代码
- 提升日志链接错误(Cmake Mingw32)
- mingw32-make '-j' 选项是否损坏
- C++ Mingw32 创建进程() 失败,错误代码 2:系统找不到指定的文件
- mingw32/bin/ld.exe:找不到 -lfl collect2.exe:错误:ld 返回 1 个退出状态
- 如何修复链接器错误"mingw32/bin/ld.exe: cannot find -lSDL"?
- 无法将 Linux openGL 程序与 mingw32 交叉编译。配置.log错误:未定义对"_glEnable"的引用
- cmd 命令启动无法与新版本的 mingw32-make.exe一起使用?
- 如何解决 mingw32-make.exe退出代码 2 错误
- MINGW32(OGRE3D CEGUI GLM应用程序)的标题冲突错误
- 启用 MingW32-make -j 上的 50% 核心利用率
- 未定义的引用 C++ MingW32
- 在哪里可以找到与Clang假设的目录结构相同的mingw32
- /Mingw32/bin/ld.exe: cannot find -llibcurl?
- 如何使用 bjam 在 cygwin windows7 i686-w64-mingw32-g++ 中编译 Boost(和
- Mingw32-w64 GCC 4.9.2 正则表达式错误,或者我不知道C++
- Mingw32中对"SDL_main"的未定义引用