Visual C++ STL 相关编译错误的解决办法
和所有的垄断企业一样,微软的做法经常是武断和专横的,一个困扰了我一个多月的问题解决了,结果竟是如此的不可思议。有一个库的binary是在VC 2005下编译的,如果用VC 2008编译例程link用VC 2005的库文件时程序会Crash,所以只能用回VC 2005编译例程。在用VC 2005编译例程的时候,link时出现了这样的错误:
error LNK2001: unresolved external symbol "void __cdecl std::_Throw(class stdext::exception const &)" (?_Throw@std@@YAXABVexception@stdext@@@Z)
error LNK2001: unresolved external symbol "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler@std@@3P6AXABVexception@stdext@@@ZA)
在网上搜了大半天,没有任何头绪,把Windows SDK升级了也不能解决问题。忽然记起用VC 2008编译时是可以通过的,搜索stdext::exception时,发现网上有些地方贴出来的类似的出错的提示信息中显示的exception头文件中,stdext::exception定义所在的行数和VC 2005中exception头文件不符,才怀疑VC 2005到VC 2008的头文件有变化,结果发现,在VC 2005中,exception是放在std的namespace中,而VC 2008的exception是放在stdext的namespace中。但是这个库的Binary为什么是在VC 2005下编译,但是用的又是stdext::exception呢?突然想到微软经常会出SP1,SP2这些东西,下了VC 2005 SP1安装之后,编译通过。据说,VC 2010还会把一些类从std移入stdext,但是为什么要把类移来移去造成混乱呢,没有找到答案。
所有高度依赖STL的VC程序都会有类似的问题,所以一般都会写明要升级到VC 2005 SP1:
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in mksnapshot.obj LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) already defined in mksnapshot.obj
10 条评论:
I couldn't refrain from commenting. Well written!
my site: click through the next web site
We are a group of volunteers and opening a brand new
scheme in our community. Your website offered us with helpful info
to work on. You've done a formidable job and our whole group can be grateful to you.
my web site: Pre-owned Superyacht ecommerce specialist
I was excited to uncover this page. I need to to thank you for ones time due to this wonderful read!
! I definitely loved every part of it and I have you saved as a favorite to look
at new stuff on your web site.
Stop by my weblog staff motivation talks
Hey! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing several weeks
of hard work due to no data backup. Do you have any methods to prevent hackers?
Here is my page: Diablo
I leave a response when I like a post on a website or
I have something to valuable to contribute to the discussion.
It's a result of the passion communicated in the post I browsed. And after this post "Visual C++ STL 相关编译错误的解决办法". I was moved enough to post a thought :-) I do have a couple of questions for you if you don't mind.
Is it simply me or does it look as if like a few of these responses appear like they are coming from brain
dead visitors? :-P And, if you are posting on additional online social sites, I would like to follow you.
Could you make a list every one of all your communal sites like your Facebook page, twitter feed,
or linkedin profile?
Here is my web blog - Resort Management Association
If you would like to obtain a good deal from this post then you have to apply
such techniques to your won weblog.
Also visit my homepage ... find out this here
Keep on writing, great job!
Also visit my web page Asian Porn
I used to be recommended this blog through my cousin.
I'm now not sure whether or not this submit is written by means of him as no one else realize such designated about my problem. You are wonderful! Thanks!
Also visit my web site :: http://sexvideovoyeur.com
Woah! I'm really loving the template/theme of this site. It's simple, yet effective.
A lot of times it's hard to get that "perfect balance" between usability and visual appeal. I must say you have done a amazing job with this. Additionally, the blog loads extremely quick for me on Safari. Superb Blog!
Here is my website: BBW Videos Free XXX Videos
Hi there all, here every person is sharing these
kinds of know-how, thus it's pleasant to read this weblog, and I used to pay a visit this webpage every day.
Also visit my webpage - http://xxx-fuck.net
发表评论