FidoProject/Fido

how to compile example

TZVIh opened this issue · 3 comments

TZVIh commented

hi,
I want to compile the ReinforcementLearning.cpp. I am using ver 0.02 with ubuntu 16.04.

I use g++/gcc and I got error of " undefined reference to.."
can you write some example how to compile it?
thanks!

There is no file named ReinforcementLearning.cpp. Do you mean tests/reinforcement.cpp?

TZVIh commented

no,
examples/ReinforcementLearning.cpp

Hi,

I created small trivial CMakeLists.txt for anyone having problems compiling/linking the examples:

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project(Fido CXX)

set(CMAKE_CXX_STANDARD 17)

set(SRCS
    src/Adadelta.cpp
    src/Backpropagation.cpp
    src/FidoControlSystem.cpp
    src/GeneticAlgo.cpp
    src/Interpolator.cpp
    src/Layer.cpp
    src/LSInterpolator.cpp
    src/NeuralNet.cpp
    src/Neuron.cpp
    src/Pruner.cpp
    src/QLearn.cpp
    src/SGDTrainer.cpp
    # src/Simulator/Emitter.cpp # commented out because of SFML dependency which I did not have
    # src/Simulator/Robby.cpp
    # src/Simulator/Simlink.cpp
    src/WireFitQLearn.cpp
)

add_library(Fido SHARED ${SRCS})
target_include_directories(Fido PUBLIC include)

add_executable(main src/main.cpp)
target_link_libraries(main Fido)

add_executable(Backpropagation examples/Backpropagation.cpp)
target_link_libraries(Backpropagation Fido)

add_executable(GeneticAlgo examples/GeneticAlgo.cpp)
target_link_libraries(GeneticAlgo Fido)

Only change #include "Fido/Fido.h" to #include "Fido.h".