Visual C++链接器崩溃(VS2008 SP1)
Visual C++ linker crashes (VS2008 SP1)
以下代码用于生成素数,在运行调试时按预期编译和运行,但在发布模式下构建时似乎总是会崩溃:
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <iostream>
template<typename T> class PrimeGen {
struct Elim {
T p ;
T e ;
} ;
class Elim_cmp {
public:
bool operator()(const Elim& e1, const Elim& e2) { return e1.e > e2.e; }
} ;
std::vector<Elim> elim_heap ;
T last ;
public:
PrimeGen() {
Elim e0 = { 2, 4 } ;
elim_heap.reserve(1024) ;
elim_heap.push_back(e0) ;
last = 2 ;
}
T next() {
T n = last ;
bool prime;
do {
n ++ ;
prime = true ;
while(n == elim_heap.front().e) {
if(prime) prime = false ;
std::pop_heap(elim_heap.begin(), elim_heap.end(), Elim_cmp()) ;
Elim& elim = elim_heap.back() ;
elim.e = elim.p + n ;
std::push_heap(elim_heap.begin(), elim_heap.end(), Elim_cmp()) ;
}
} while(!prime) ;
Elim e = { n, 2*n } ;
elim_heap.push_back( e ) ;
std::push_heap(elim_heap.begin(), elim_heap.end(), Elim_cmp()) ;
return last = n ;
}
} ;
int main()
{
using namespace std ;
PrimeGen<unsigned int> pgen ;
for(int i=0; i<100; i++) {
cout << pgen.next() << endl ;
}
system("pause") ;
}
有人明白为什么会发生这种事吗?或者我遇到过这样一种罕见的情况,编译器而不是代码应该受到谴责?
我得到的错误如下:
error PRJ0002 : Error result -1073741819 returned from 'C:Program FilesMicrosoft SDKsWindowsv6.0Abinmt.exe'.
如果其他运行VisualStudio的人花时间尝试在发布模式下构建代码(我已经删除了任何外部依赖项,所以应该只是c&p),我会非常感激。
更新:经过进一步审查,即使是简单的"Hello World"代码,mt.exe在发布模式下似乎也会不断崩溃,所以我的安装肯定有问题。我要重新安装所有有望解决这个问题的东西。主持人,请随意结束这个问题。
某些程序(如防病毒程序)在链接器尝试嵌入清单文件的同时扫描file.exe。
相关文章:
- VS2008中的AVX-512指令库
- VS2008 SP1:将一对推入矢量时没有合适的默认构造函数可用
- VS2008,VS2015无法读取文件:怪异的行为
- C (VS2008)未生成对象文件
- VS2008 C 警告LNK4229:无效指令
- VS2008无法使用SetunHandLeDExceptionFilter捕获异常
- 从VS2008升级后,VS2012中的构建项目显示错误
- Qt C++在Win XP SP1上不起作用
- 为什么我的所有测试方法都没有显示在VS2008中单元测试的测试列表中?
- 为什么安装 VSTS 2010 SP1 后找不到 Ws2_32.lib
- LNK2001和LNK2019 VS2008期间(或VS2010)的错误从VS2005升级
- 使用VS2008编译的C/C++中存在结构复制问题
- VS2008-项目已过期,没有更改任何代码行
- 'DLLVERSIONINFO' 从VS2008将项目更新到VS2012后编译错误
- 编译VS2008 soln时标准Microsoft文件"iosfwd"和"atlconv.h"中的语法错误?
- 链接从VS2012项目使用VS2008构建的静态库?它们兼容吗
- 来自 Qt Creator 中 VS2008 的 lib
- std::tr1::函数为VS2008 SP1中的x64配置提供链接错误
- TLS 1.1 with VS2008 SP1
- Visual C++链接器崩溃(VS2008 SP1)