向CUDA project中添加了如下的包含目录后:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\include;
..\include_p;
..\include_p\gdal;
..\include_p\mysql;
..\include;
..\include_cg;
$(IncludePath)

在main.cu中添加如下包含文件:

#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#include <cuda_device_runtime_api.h> #include "cuda_helloworld_kernel.cu"
#include "host_rapc_cuda.cu"

而host_rapc_cuda.cu文件又包含了:

#include "gt_geometry.h"
#include "phd_rapc_vtx.h"//该文件包含了gt_datasource.h文件,后者又包含了mysql_global.h文件,与CUDA的math_functions.h中定义的相同名称的rint函数引起了冲突
#include "gt_geometryoverlay_phdpaper.h"

编译项目,出现下面的症状:

错误    433    error C2264: “rint”: 函数定义或声明中有错误;未调用函数    c:\program files\nvidia gpu computing toolkit\cuda\v5.5\include\math_functions.h    11639

分析:

CUDA的rint函数定义在math_functions.h中,实现如下:

static __inline__ __host__ __device__ float rint(float a)
{
return rintf(a);
}

mysql的rint的函数定义在my_global.h中,实现如下:

#ifndef HAVE_RINT
/**
All integers up to this number can be represented exactly as double precision
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
*/
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1) /**
rint(3) implementation for platforms that do not have it.
Always rounds to the nearest integer with ties being rounded to the nearest
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
Unlike this implementation, hardware will also honor the FPU rounding mode.
*/ static inline double rint(double x)
{
double f, i;
f = modf(x, &i); /*
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
no need to check it.
*/
if (x > 0.0)
i += (double) ((f > 0.5) || (f == 0.5 &&
i <= (double) MAX_EXACT_INTEGER &&
(longlong) i % ));
else
i -= (double) ((f < -0.5) || (f == -0.5 &&
i >= (double) -MAX_EXACT_INTEGER &&
(longlong) i % ));
return i;
}
#endif /* HAVE_RINT */

由此可见,mysql和CUDA中对rint函数的重复定义在编译时引起了混淆,而mysql中的rint函数可以通过定义HAVE_RINT宏进行控制,我们在gts_cg_port.h头文件中添加定义:

#define HAVE_RINT 1

重新编译gtcg库后,再重新编译我们的CUDA工程,错误消失,编译成功。

CUDA(5.5)与MySQL 5.6的rint函数定义冲突引起的VS编译器C2264错误的更多相关文章

  1. MySQL 日期、时间转换函数

    MySQL 日期.时间转换函数:date_format(date,format), time_format(time,format) 能够把一个日期/时间转换成各种各样的字符串格式.它是 str_to ...

  2. mysql中bit_count和bit_or函数的含义

    翻阅mysql手册时,看到有个示例使用了bit_or方法来去除重复的数据,一开始没看明白,后来看明白之后感觉非常巧妙.示例要实现的功能就是计算每月有几天有访问,先把示例摘录在这里. 1 2 3 4 5 ...

  3. 在MySQL向表中插入中文时,出现:incorrect string value 错误

    在MySQL向表中插入中文时,出现:incorrect string value 错误,是由于字符集不支持中文.解决办法是将字符集改为GBK,或UTF-8.      一.修改数据库的默认字符集   ...

  4. MySQL 获得当前日期时间\时间戳 函数 ( 转自传智播客)

    MySQL 获得当前日期时间 函数 1.1 获得当前日期+时间(date + time)函数:now() mysql> select now(); +-------+ | now() | +-- ...

  5. mysql中You can’t specify target table for update in FROM clause错误解决方法

    mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...

  6. mysql中的去除空格函数

    (1)mysql replace 函数 语法:replace(object,search,replace) 意思:把object中出现search的全部替换为replace 案例:update `ne ...

  7. mysql 中时间和日期函数应用

    一.MySQL 获得当前日期时间 函数 1.1 获得当前日期+时间(date + time)函数:now() mysql> select now(); +-------------------- ...

  8. MySqL触发器以及常用转换函数注意事项

    1,触发器(http://www.cnblogs.com/zzwlovegfj/archive/2012/07/04/2576989.html)       1.MYSQL中触发器中不能对本表进行 i ...

  9. MySql 学习之路-Date函数

    MySQL中重要的内建函数 函数 描述 NOW() 返回当前的日期和时间 NOW() 返回当前的日期和时间. 语法 NOW() -- 实例 -- 下面是 SELECT 语句: SELECT NOW() ...

随机推荐

  1. [原创]K8正方系统密码解密工具

    工具: K8_zfsoftDecode编译: 自己查壳组织: K8搞基大队[K8team]作者: K8拉登哥哥博客: http://qqhack8.blog.163.com发布: 2015/8/1 1 ...

  2. Centos 7 快速搭建IOS可用IPsec

    安装 strongswan yum install -y http://ftp.nluug.nl/pub/os/Linux/distr/fedora-epel/7/x86_64/Packages/e/ ...

  3. sql练习(针对Mysql)

    创建表: DROP TABLE DEPT; --部门表 CREATE TABLE DEPT( DEPTNO int PRIMARY KEY, DNAME ) , --部门名称 LOC ) ---部门地 ...

  4. jquery.cropper 裁剪图片上传

    https://github.com/fengyuanchen/cropper 1.必要的文件引用: <script src="/path/to/jquery.js"> ...

  5. godaddy 问题

    1. 域名被锁,打电话咨询后.说发送被锁的域名到: change@secureserver.net 去解锁.

  6. JAVA多态计算面积main函数调用方法

    public static void main(String[] args) { Shape shape; Scanner input = new Scanner(System.in); System ...

  7. Chapter 2 Open Book——13

    "People in this town," he muttered. "Dr. Cullen is a brilliant surgeon who could prob ...

  8. 目标检测技术演进:R-CNN、Fast R-CNN、Faster R-CNN

    看到一篇循序渐进讲R-CNN.Fast R-CNN.Faster R-CNN演进的博文,写得非常好,摘入于此,方便查找和阅读. object detection,就是在给定的图片中精确找到物体所在位置 ...

  9. INSERT INTO IF EXISTS

    INSERT INTO books (name) SELECT 'MySQL Manual' FROM dual WHERE NOT EXISTS (SELECT id FROM booksWHERE ...

  10. rpm 软件包管理

    rpm---Redhat Pachage Manager 挂载光盘: [root@localhost sdb1]# mount /dev/sr0 /mnt [root@localhost sdb1]# ...