您的位置:首页 > 编程语言 > C语言/C++

vs2010c++boost编写客户端,编译通过,启动就报应用程序无法启动(0xc000007b)

2013-07-16 17:35 525 查看
代码如下:

#include <iostream>

#include "../Share/comm.h"

/************************************************************************/

/* 客户端 */

/************************************************************************/

void proc_connect(socket_type sock, ip::tcp::endpoint& ep)

{

bool bConnectFlag = false;

while (true)

{

//当没有连接上服务器时,每隔一秒连接一次

try

{

if (!bConnectFlag)

{

cout<<"connecting..."<<endl;

//阻塞的timer

io_service ios;

deadline_timer timer(ios, posix_time::seconds(1));

timer.wait(); //进行同步等待

sock->connect(ep);

}

else

{

//向服务器发送数据

cout<<endl<<"please input:";

string str;

cin>>str;

sock->write_some(buffer(str));

//读取服务器发送的数据

vector<char> recvbuf(100, 0);

sock->read_some(buffer(recvbuf));

cout<<"recv from server:"<<&recvbuf[0]<<endl;

}

bConnectFlag = true;

}

//捕获网络异常

catch(std::exception& e)

{

sock->close();

bConnectFlag = false;

cout<<e.what()<<endl;

}

}

}

int main(int argc, int argv[])

{

//初始化ios对象

io_service ios;

//初始化连接服务器的socket

socket_type sock(new ip::tcp::socket(ios));

//初始化需要连接的服务器的地址以及端口号

ip::tcp::endpoint ep(ip::address::from_string("127.0.0.1"), PORT_NUM);

thread t1(proc_connect, sock, ep);

t1.join();

return 0;

}

我的系统为window764位,导入的boost库为32位的。

请问各位大侠如何解决?

已经解决:

1.boost编译未完全编译

bjam --toolset=msvc-10.0 architecture=x86 address-model=64 --build-type=complete stage debug release

--build-type=complete
stage 参数为全部编译

重新编译boost库

2.

这三个lib文件放到工程的静态编译目录就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐