When using this make file I wrote my program compiles however it doesn’t act the way it is supposed.
CC := g++
SRC := src
PROJECT_NAME := main
SRC_FILES := $(shell find $(SRC) -name '*.cpp')
inc := -I /usr/include/eigen3
CFLAGS := -Wall
OPTIMLEVEL := -O3
all:
$(CC) $(CFLAGS) $(inc) $(SRC_FILES) $(OPTIMLEVEL) -o $(PROJECT_NAME)
.PHONY: clean
clean:
rm -rf $(PROJECT_NAME)
running this simply results in an error
error: ‘A’ does not name a type A.diagonal().setConstant(4);
#include <Eigen/Dense>
int n = 4;
Eigen::MatrixXf A(n,n);
A.diagonal().setConstant(4);
A.setZero();
A.diagonal().setConstant(4);
int main (void){
printf("Hello World! n");
return 0;
}
I have checked and Eigen library lies in the stated directory. This is done in vscode and it provieds me with a diffrent error message.
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/albert/docs/hobby/Arduino/eigen_test/src/main.cpp).C/C++(1696)
cannot open source file “Eigen/Dense”
1