![](/img/trans.png)
[英]SFML 2.1 program runs fine in debug mode, but crashes in release mode
[英]VS program crashes in debug but not release mode?
我正在VS 2012中运行以下程序以尝试Thrust函数查找:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <thrust/find.h>
#include <thrust/device_vector.h>
#include <stdio.h>
int main() {
thrust::device_vector<char> input(4);
input[0] = 'a';
input[1] = 'b';
input[2] = 'c';
input[3] = 'd';
thrust::device_vector<char>::iterator iter;
iter = thrust::find(input.begin(), input.end(), 'a');
std::cout << "Index of a = " << iter - input.begin() << std::endl;
return 0;
}
这是取自http://docs.thrust.googlecode.com/hg/group__searching.html#ga99c7a59cef5b9f4cdbc70f37b2e221be的代码示例的修改版本
当我在“调试”模式下运行此程序时,程序崩溃,并且出现错误“ Debug Error! ... R6010 - abort() has been called
Debug Error! ... R6010 - abort() has been called
。 但是,在Release模式下运行它,我得到的期望输出Index of a = 0
。
我知道崩溃是由于包含find函数的行而发生的。
是什么原因导致这种情况发生?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.