无法使用特征库进行编译
Cannot compile with Eigen Library
我正在Linux
上编写一个C++
应用程序。
对于特定任务,我需要包含Eigen
库。
我安装了libeigen3-dev
包,并以这种方式将其包含在我的代码中:
#include <Eigen/Dense>
然后,我尝试使用以下命令编译此文件:
g++ -I/usr/include/eigen3 -c TetrisAgent.cpp -o TetrisAgent.o
我正在使用gcc version 4.7.2
.
不幸的是,由于此错误,我无法编译它:
In file included from /usr/include/eigen3/Eigen/Core:329:0,
from /usr/include/eigen3/Eigen/Dense:1,
from TetrisAgent.cpp:24:
/usr/include/eigen3/Eigen/src/Core/GeneralProduct.h:121:14: error: expected ‘>’ before numeric constant
/usr/include/eigen3/Eigen/src/Core/GeneralProduct.h:121:56: error: ‘N’ was not declared in this scope
/usr/include/eigen3/Eigen/src/Core/GeneralProduct.h:121:59: error: template argument 2 is invalid
make: *** [TetrisAgent.o] Error 1
谁能帮我修复它?
编辑:这是为了回答阿尔伯特的问题"在包含之前,你很可能已经在自己的代码(俄罗斯方块代理.cpp)中出现了错误。你能把所有代码都添加到包含中,即前 24 行吗?
/*
* Copyright (C) 2008, Brian Tanner
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stdio.h> /* for printf */
#include <string.h> /* for strcmp */
#include <time.h> /*for time()*/
#include <rlglue/Agent_common.h> /* agent_ function prototypes and RL-Glue types */
#include <rlglue/utils/C/RLStruct_util.h> /* helpful functions for allocating structs and cleaning them up */
#include "tetris_utils.h"
#include <vector>
#include <Eigen/Dense>
编辑 2:这是tetris_utils.h
文件的代码:
#define GRID_WIDTH 10
#define GRID_HEIGHT 20
#define BATCH_SIZE 100
//number of games before updating the weights
#define M 10
static int available_rotations[] = {1,3,3,0,1,1,3};
static int max_position[7][4] = {{10,7,0,0},
{9,8,9,8},
{9,8,9,8},
{9,0,0,0},
{8,9,0,0},
{8,9,0,0},
{8,9,8,9} };
struct state_dump{
int features[21];
float V;
float reward;
};
#define M 10
^ 在不考虑范围的情况下重新定义单个字母是一个坏主意。
请尝试static int const M = 10;
。
相关文章:
- 编译时检查特征专用化是否具有唯一 ID
- 标量类型的特征模板无法编译固定大小的子矩阵操作
- 使用 C++17 编译特征需要_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING定义
- 编译特征程序时出错:错误:'seq'不是'Eigen'的成员
- 特征张量编译误差
- NVCC编译了特征库,并在运行时失败的结构中的MatrixxD大小
- 特征:返回对具有编译时间尺寸检查的矩阵块的引用
- 特征部分PivLU示例无法编译
- 在编译时检查特征类型保存的数据在内存中是否连续
- 如何使用特征访问编译时const值
- C++ 模板特征 -- 编译时不包含标头
- 为什么编译(c ++ 特征)"错误 C2659:'=':函数作为左操作数"后会出现错误?
- C :多态容器 /迭代器与编译时间概念 /特征
- 编译时解决方案以检测特征对象没有eval()成员
- 在 boost::type_traits::条件中使用类型特征的编译错误
- 用nvcc(CUDA)编译特征库
- 编译特征C++QT
- 编译错误 将模板编程与特征C++库结合使用
- 无法使用特征库进行编译
- NVIDIA NVCC 在使用模板特征类型时更改编译时间常量