how to compile the C++ WFG benchmark

TL;DR: you need to add a makefile!

WFG (Walking Fish Group) benchmark is a set of testing problems. Such a benchmark has been developed in C++ and can be downloaded here. However, compiling it can be problematic, at least for me. If you are facing the same issue, unzip WFG_v2006.03.28.zip, copy this snippet and save it as makefile inside WFG_v2006.03.28:

# compiler
CC=g++

# flags
CFLAGS=-c -Wall -g

all: main 

main:         main.o exampleproblems.o exampleshapes.o exampletransitions.o frameworkfunctions.o misc.o shapefunctions.o transfunctions.o
	$(CC) -g  main.o exampleproblems.o exampleshapes.o exampletransitions.o frameworkfunctions.o misc.o shapefunctions.o transfunctions.o -lm -o main.out

# -------------- dependencies ------------

main.o:
	$(CC) $(CFLAGS) main.cpp

exampleproblems.o:
	$(CC) $(CFLAGS) Toolkit/ExampleProblems.cpp -o exampleproblems.o
	
exampleshapes.o:
	$(CC) $(CFLAGS) Toolkit/ExampleShapes.cpp -o exampleshapes.o
	
exampletransitions.o:
	$(CC) $(CFLAGS) Toolkit/ExampleTransitions.cpp -o exampletransitions.o
	
frameworkfunctions.o:
	$(CC) $(CFLAGS) Toolkit/FrameworkFunctions.cpp -o frameworkfunctions.o
	
misc.o:
	$(CC) $(CFLAGS) Toolkit/Misc.cpp -o misc.o
	
shapefunctions.o:
	$(CC) $(CFLAGS) Toolkit/ShapeFunctions.cpp -o shapefunctions.o
	
transfunctions.o:
	$(CC) $(CFLAGS) Toolkit/TransFunctions.cpp -o transfunctions.o

# -------------- clean ------------

clean:
	rm *.o *.out

Your WFG directory should look like this:

auraham@roku:~/Desktop/zips/WFG_v2006.03.28$ ls
CHANGE_LOG.txt main.cpp makefile README.txt Toolkit

Then, execute the following command:

auraham@roku:~/Desktop/zips/WFG_v2006.03.28$ make

Output:
g++ -c -Wall -g main.cpp
g++ -c -Wall -g Toolkit/ExampleProblems.cpp -o exampleproblems.o
g++ -c -Wall -g Toolkit/ExampleShapes.cpp -o exampleshapes.o
g++ -c -Wall -g Toolkit/ExampleTransitions.cpp -o exampletransitions.o
g++ -c -Wall -g Toolkit/FrameworkFunctions.cpp -o frameworkfunctions.o
g++ -c -Wall -g Toolkit/Misc.cpp -o misc.o
g++ -c -Wall -g Toolkit/ShapeFunctions.cpp -o shapefunctions.o
g++ -c -Wall -g Toolkit/TransFunctions.cpp -o transfunctions.o
g++ -g main.o exampleproblems.o exampleshapes.o exampletransitions.o frameworkfunctions.o misc.o shapefunctions.o transfunctions.o -lm -o main.out

Now, you are ready to run the test program:


auraham@roku:~/Desktop/zips/WFG_v2006.03.28$ ./main.out WFG1

And that’s all!

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s