Reputation: 10334
I am writing a C++
application on Linux
.
For a particular task I need to include the Eigen
library.
I installed the libeigen3-dev
packages and I include it in my code in this way:
#include <Eigen/Dense>
I then try to compile this file with the command:
g++ -I/usr/include/eigen3 -c TetrisAgent.cpp -o TetrisAgent.o
I'm using gcc version 4.7.2
.
Unfortunately, I am not able to compile it, due to this error:
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
Can anyone help me fixing it?
EDIT: This is to answer Albert question "You very probably already have the error in your own code (TetrisAgent.cpp) before the include. Can you add all the code up to the include, i.e. the first 24 lines?"
/*
* 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>
EDIT 2: this is the code of the tetris_utils.h
file:
#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;
};
Upvotes: 0
Views: 1392
Reputation: 137940
#define M 10
^ Redefining an individual letter without respect for scope is a bad idea.
Try static int const M = 10;
instead.
Upvotes: 2