FidoProject / Fido

A lightweight C++ machine learning library for embedded electronics and robotics.
http://fidoproject.github.io/
MIT License
439 stars 81 forks source link

how to compile example #66

Open TZVIh opened 7 years ago

TZVIh commented 7 years ago

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!

hmwildermuth commented 7 years ago

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

TZVIh commented 7 years ago

no, examples/ReinforcementLearning.cpp

pptaszni commented 2 years ago

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".