include 新库的时候遇到的问题。

2018-04-06 11:07:06 +08:00
 15584185420

一个非常简单的问题。因为我是一个半路出家的程序员,而且比较菜,所以想在这里问一下。我使用 c++eigen 库写了一个算法,现在想把他改成 GPU 格式的,所以需要

#include <amp.h> #include <amp_math.h> using namespace concurrency; using namespace precise_math; 这两个头文件 但是本来可以编译的程序却出现了一大堆错误, C2632 int 后面的 int 非法 c2143 语法错误等 是我命名空间使用冲突了吗还是怎么回事儿? 求助!

2462 次点击
所在节点    C
6 条回复
gnaggnoyil
2018-04-06 11:28:48 +08:00
你连具体的错误信息都没给出让人怎么分析...MSVC 的 C2632 直接原因是把一个指代 type 的 name 给企图挪作它用,LZ 这种情况可能是两个 namespace 的名字一个用于指代类型一个用于指代别的……
MeteorCat
2018-04-06 11:30:00 +08:00
可能命名空间里面重写定义了 int 类型,math 高精度库常常会自己定义一个高精度数值类型,可能是这样这样导致冲突了,试下单独 using 不要直接 using namespace
15584185420
2018-04-06 11:46:06 +08:00
@MeteorCat 直接 using convurrency 而不是 using namespace concurrency;?
15584185420
2018-04-06 11:47:20 +08:00
@gnaggnoyil
C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h:157: error: C2632: “ int ”后面的“ int ”非法
C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h:158: error: C2632: “ char ”后面的“ char ”非法
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h:726: error: C2632: “__int64 ”后面的“ long ”非法
C:\Program Files (x86)\Windows Kits\8.1\include\um\wingdi.h:5011: error: C2143: 语法错误: 缺少“)”(在“常量”的前面)
C:\Program Files (x86)\Windows Kits\8.1\include\um\winuser.h:8274: error: C2059: 语法错误:“常量”
15584185420
2018-04-06 11:53:11 +08:00
#include <djDraw.h>

#include <Eigen>

#include <iostream>

#include<inverse.h>

#include<forwardfuction.h>

#include<basicfuction.h>



using namespace Eigen;

using namespace std;
新添加了:“
#include <amp.h>
#include <amp_math.h>
using namespace concurrency;
using namespace precise_math;
15584185420
2018-04-06 13:53:19 +08:00
@MeteorCat
@gnaggnoyil
已经解决,调换一下 include。*h 之间的顺序就解决了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/444625

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX