如何在vc6.0++中安装Zthread库啊

龙小VIP 2009-09-22 10:49:26
从网上下了个Zthread库源文件,但在vc6.0++上不会有,还请高手帮助啊
...全文
324 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jalien 2009-10-20
  • 打赏
  • 举报
回复
错误提示发生重定义错误。应该是你这个工程的运行库与你编译ZThread.lib选择的运行库选项不同
选择一样的运行库就可以了。
譬如你可以都选择运行库选项为/MT (链接的是LIBCPMT.LIB,多线程静态链接的Release版本)


fox000002 2009-09-22
  • 打赏
  • 举报
回复
建个 static library 的 project

导入源文件 .cxx 文件

编译即可
龙小VIP 2009-09-22
  • 打赏
  • 举报
回复
都指定了,如:Link\input
现在的情况是:只要我用Thread t(new aRunnable); 就报异常。
Wolf0403 2009-09-22
  • 打赏
  • 举报
回复
工程参数指定链接 zthread 库没有?
龙小VIP 2009-09-22
  • 打赏
  • 举报
回复
编译通过了。我把lib文件考到了vc98\lib下面,然后编译了一个测试程序,报异常,异常如下:
--------------------Configuration: zthread_test_0922 - Win32 Debug--------------------
Linking...
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *,class std::a
llocator<char> const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z) already defined in libcpmtd.lib(ios.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in libcpmtd.lib(iostream.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<c
har,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in libcpmtd.lib(ios.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _abort already defined in LIBCMTD.lib(abort.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/zthread_test_0922.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

zthread_test_0922.exe - 7 error(s), 1 warning(s)
---------------------------------------------------------------
代码如下:
#include "zthread/thread.h"
#include"zthread/Runnable.h"
#include <iostream>
using namespace std;
using namespace ZThread;

class aRunnable : public Runnable {

void run() {

Thread::sleep(1000);
std::cout << "Hello from another thread" << std::endl;

}

};

int main() {

try {

// Implictly constructs a Task
Thread t(new aRunnable);

} catch(Synchronization_Exception& e) {
std::cerr << e.what() << std::endl;
}

std::cout << "Hello from the main thread" << std::endl;

// Output:

// Hello from the main thread
// Hello from another thread
cin.get();
return 0;

}
龙小VIP 2009-09-22
  • 打赏
  • 举报
回复
e:\学习研究\研究\源代码\zthread-2.3.2\zthread-2.3.2\src\threadimpl.cxx(441) : error C2086: 'i' : redefinition
ThreadLocalImpl.cxx
ThreadOps.cxx
d:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<ZThread::ThreadLocalImpl const *,std::pair<ZThread::ThreadLocalImpl const * const,ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned i
nt> >,std::map<ZThread::ThreadLocalImpl const *,ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int>,std::less<ZThread::ThreadLocalImpl const *>,std::allocator<ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int> > >::_Kfn,
std::less<ZThread::ThreadLocalImpl const *>,std::allocator<ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int> > >::iterator,bool>::pair<std::_Tree<ZThread::ThreadLocalImpl const *,std::pair<ZThread::ThreadLocalImpl const * const,ZThre
ad::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int> >,std::map<ZThread::ThreadLocalImpl const *,ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int>,std::less<ZThread::ThreadLocalImpl const *>,std::allocator<ZThread::CountedPtr
<ZThread::ThreadLocalImpl::Value,unsigned int> > >::_Kfn,std::less<ZThread::ThreadLocalImpl const *>,std::allocator<ZThread::CountedPtr<ZThread::ThreadLocalImpl::Value,unsigned int> > >::iterator,bool>' : identifier was truncated to '255' characters
in the debug information
e:\学习研究\研究\源代码\zthread-2.3.2\zthread-2.3.2\src\win32\threadops.cxx(169) : error C2039: '_beginthreadex' : is not a member of '`global namespace''
e:\学习研究\研究\源代码\zthread-2.3.2\zthread-2.3.2\src\win32\threadops.cxx(169) : error C2065: '_beginthreadex' : undeclared identifier
e:\学习研究\研究\源代码\zthread-2.3.2\zthread-2.3.2\src\win32\threadops.cxx(188) : error C2039: '_endthreadex' : is not a member of '`global namespace''
e:\学习研究\研究\源代码\zthread-2.3.2\zthread-2.3.2\src\win32\threadops.cxx(188) : error C2065: '_endthreadex' : undeclared identifier
ThreadQueue.cxx
Time.cxx
Error executing cl.exe.

Zthread.lib - 5 error(s), 1 warning(s)

报的异常如下,请高手分析一下啊
龙小VIP 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用楼主 liudan319 的回复:]
从网上下了个Zthread库源文件,但在vc6.0++上不会有,还请高手帮助啊
[/Quote]

不对啊,编译出现问题

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧