sm-egan / oxford-lhcb-wmass

0 stars 0 forks source link

Compiling with classes #2

Open mvesteri opened 6 years ago

mvesteri commented 6 years ago

@sm-egan

#include all binaries in the "all" list
all: bin/TemplateStruct.o bin/create_templates.exe

#general "rule" to make a compile a .o libary
bin/%.o: src/%.cxx src/%.h
        $(CC) $< -o $@ $(ROOT) $(LHAPDF) $(CFLAGS)
mvesteri commented 6 years ago

Note that the class itself gives some compile time errors at the moment.

sm-egan commented 6 years ago

Hi Mika, I've tried several iterations of this and am still having trouble. Was this the code that you were able to run?

mvesteri commented 6 years ago

I didn't manage to run it. Just got it to try and compile the class with those extra lines in the Makefile. Let me quickly try to test it with an empty skeleton class.

sm-egan commented 6 years ago

I just had a small error, it starts the compiling process now!

mvesteri commented 6 years ago

The following works for me (where Test is a basic skeleton class, and testMain creates an instance of this class).

ROOT=`root-config --cflags` `root-config --libs --glibs`
CFLAGS = -O3  -Wall -std=c++11 -pedantic -Wshadow

all: bin/testMain.exe

bin/testMain.exe: src/testMain.cxx src/Test.cxx src/Test.h
        g++ src/testMain.cxx src/Test.cxx src/Test.h -o bin/testMain.exe  $(ROOT) $(LHAPDF) $(CFLAGS) 

clean:
        rm -f bin/*.exe bin/*.o
sm-egan commented 6 years ago

I changed the make file to this format and got the program compiling and running again, thank you!