V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
15584185420
V2EX  ›  C

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

  •  
  •   15584185420 · 2018-04-06 11:07:06 +08:00 · 2434 次点击
    这是一个创建于 2183 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    6 条回复    2018-04-06 13:53:19 +08:00
    gnaggnoyil
        1
    gnaggnoyil  
       2018-04-06 11:28:48 +08:00   ❤️ 1
    你连具体的错误信息都没给出让人怎么分析...MSVC 的 C2632 直接原因是把一个指代 type 的 name 给企图挪作它用,LZ 这种情况可能是两个 namespace 的名字一个用于指代类型一个用于指代别的……
    MeteorCat
        2
    MeteorCat  
       2018-04-06 11:30:00 +08:00 via Android   ❤️ 1
    可能命名空间里面重写定义了 int 类型,math 高精度库常常会自己定义一个高精度数值类型,可能是这样这样导致冲突了,试下单独 using 不要直接 using namespace
    15584185420
        3
    15584185420  
    OP
       2018-04-06 11:46:06 +08:00
    @MeteorCat 直接 using convurrency 而不是 using namespace concurrency;?
    15584185420
        4
    15584185420  
    OP
       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
        5
    15584185420  
    OP
       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
        6
    15584185420  
    OP
       2018-04-06 13:53:19 +08:00
    @MeteorCat
    @gnaggnoyil
    已经解决,调换一下 include。*h 之间的顺序就解决了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1195 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:24 · PVG 02:24 · LAX 11:24 · JFK 14:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.