- 论坛徽章:
- 0
|
有关openssl在c++环境下,能编译,不能链接输出???
设置:
用的eclipse CDT+ MinGW5.1, openssl0.98d
mingw按照网上的配置下的是安装版.openssl也是安装版,里面有支持mingw的库,要拷到mingw的lib下..h 拷到include里.
eclipse CDT 没有什么设置的.其中有一项改一下.
windows环境里设置一下.加入include_path, and lib_path,
include 设置是应该没有问题的,起码eclipse能够assistant help,也是能编译成功的原因吧.
但是链接时却不成成功.
我试写了一个简单的输出"hello the world",能够链接成功.但是只要有openssl的函数,就只能编译到.o文件, 不能链接输出.exe文件.怪了.
测试代码
能够编译,并链接成功,输出一个可执行程序.
using namespace std;
int main(){
cout<<"hello the world";
return 0;
}
但是只有有openssl函数,只能编译,不能链接.
我的Makefile文件.
all:
g++ -c test.c
g++ -o test.exe test.o
g++ -c Client4c.cpp
g++ -o Client4c Client4c.o
输出输出.
make -k all
g++ -c test.c ------------------测试程序
test.c:22:2: warning: no newline at end of file
g++ -o test.exe test.o ------链接测试程序,可输出.exe程序.也能运行...
g++ -c Client4c.cpp --------带有openssl的函数,能编译..但是下面不能运行.
Client4c.cpp:140:2: warning: no newline at end of file
g++ -o Client4c Client4c.o
Client4c.o(.text+0x4a):Client4c.cpp: undefined reference to `WSAStartup@8'
Client4c.o(.text+0x7a):Client4c.cpp: undefined reference to `SSL_library_init'
Client4c.o(.text+0x7f):Client4c.cpp: undefined reference to `SSL_load_error_strings'
Client4c.o(.text+0x84):Client4c.cpp: undefined reference to `TLSv1_client_method'
Client4c.o(.text+0x9:Client4c.cpp: undefined reference to `SSL_CTX_new'
Client4c.o(.text+0xc:Client4c.cpp: undefined reference to `SSL_CTX_set_verify'
.................省略....
请有使用openssl经验的同仁,帮助看一下...
多谢..
tyshanchn#hotmail.com |
|