Skip to content

not able to compile the provided examples #148

@rajkamal-007

Description

@rajkamal-007

Hi,
I've followed the installation guide and I was trying to run the xor_sample.cpp example on ubuntu 16.04 LTS. the error messages are as follows:
xor_sample.cpp: In function ‘int print_callback(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*)’:
xor_sample.cpp:42:64: warning: unused parameter ‘train’ [-Wunused-parameter]
42 | int print_callback(FANN::neural_net &net, FANN::training_data &train,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~
xor_sample.cpp:43:18: warning: unused parameter ‘max_epochs’ [-Wunused-parameter]
43 | unsigned int max_epochs, unsigned int epochs_between_reports,
| ~~~~~~~~~~~~~^~~~~~~~~~
xor_sample.cpp:43:43: warning: unused parameter ‘epochs_between_reports’ [-Wunused-parameter]
43 | unsigned int max_epochs, unsigned int epochs_between_reports,
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
xor_sample.cpp:44:11: warning: unused parameter ‘desired_error’ [-Wunused-parameter]
44 | float desired_error, unsigned int epochs, void user_data)
| ~~~~~~^~~~~~~~~~~~~
xor_sample.cpp:44:53: warning: unused parameter ‘user_data’ [-Wunused-parameter]
44 | float desired_error, unsigned int epochs, void user_data)
| ~~~~~~^~~~~~~~~
xor_sample.cpp: In function ‘int main(int, char
)’:
xor_sample.cpp:138:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
138 | int main(int argc, char **argv)
| ~~~~^~~~
xor_sample.cpp:138:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
138 | int main(int argc, char argv)
| ~~~~~~~^~~~
/tmp/ccIST7S8.o: In function FANN::training_data::destroy_train()': xor_sample.cpp:(.text._ZN4FANN13training_data13destroy_trainEv[_ZN4FANN13training_data13destroy_trainEv]+0x23): undefined reference to fann_destroy_train'
/tmp/ccIST7S8.o: In function FANN::training_data::read_train_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': xor_sample.cpp:(.text._ZN4FANN13training_data20read_train_from_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4FANN13training_data20read_train_from_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2c): undefined reference to fann_read_train_from_file'
/tmp/ccIST7S8.o: In function FANN::training_data::save_train_to_fixed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)': xor_sample.cpp:(.text._ZN4FANN13training_data19save_train_to_fixedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj[_ZN4FANN13training_data19save_train_to_fixedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj]+0x46): undefined reference to fann_save_train_to_fixed'
/tmp/ccIST7S8.o: In function FANN::training_data::length_train_data()': xor_sample.cpp:(.text._ZN4FANN13training_data17length_train_dataEv[_ZN4FANN13training_data17length_train_dataEv]+0x2a): undefined reference to fann_length_train_data'
/tmp/ccIST7S8.o: In function FANN::neural_net::destroy()': xor_sample.cpp:(.text._ZN4FANN10neural_net7destroyEv[_ZN4FANN10neural_net7destroyEv]+0x23): undefined reference to fann_get_user_data'
xor_sample.cpp:(.text._ZN4FANN10neural_net7destroyEv[_ZN4FANN10neural_net7destroyEv]+0x4e): undefined reference to fann_destroy' /tmp/ccIST7S8.o: In function FANN::neural_net::create_standard_array(unsigned int, unsigned int const
)':
xor_sample.cpp:(.text._ZN4FANN10neural_net21create_standard_arrayEjPKj[_ZN4FANN10neural_net21create_standard_arrayEjPKj]+0x2c): undefined reference to fann_create_standard_array' /tmp/ccIST7S8.o: In function FANN::neural_net::run(float
)':
xor_sample.cpp:(.text._ZN4FANN10neural_net3runEPf[_ZN4FANN10neural_net3runEPf]+0x35): undefined reference to fann_run' /tmp/ccIST7S8.o: In function FANN::neural_net::init_weights(FANN::training_data const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net12init_weightsERKNS_13training_dataE[_ZN4FANN10neural_net12init_weightsERKNS_13training_dataE]+0x3d): undefined reference to fann_init_weights' /tmp/ccIST7S8.o: In function FANN::neural_net::save(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4FANN10neural_net4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x40): undefined reference to fann_save' /tmp/ccIST7S8.o: In function FANN::neural_net::save_to_fixed(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net13save_to_fixedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4FANN10neural_net13save_to_fixedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x40): undefined reference to fann_save_to_fixed' /tmp/ccIST7S8.o: In function FANN::neural_net::train_on_data(FANN::training_data const&, unsigned int, unsigned int, float)':
xor_sample.cpp:(.text._ZN4FANN10neural_net13train_on_dataERKNS_13training_dataEjjf[_ZN4FANN10neural_net13train_on_dataERKNS_13training_dataEjjf]+0x52): undefined reference to fann_train_on_data' /tmp/ccIST7S8.o: In function FANN::neural_net::get_MSE()':
xor_sample.cpp:(.text._ZN4FANN10neural_net7get_MSEEv[_ZN4FANN10neural_net7get_MSEEv]+0x2c): undefined reference to fann_get_MSE' /tmp/ccIST7S8.o: In function FANN::neural_net::set_callback(int ()(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void), void*)':
xor_sample.cpp:(.text.ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4[ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4]+0x2f): undefined reference to fann_get_user_data' xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[_ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_]+0xa9): undefined reference to fann_set_user_data'
xor_sample.cpp:(.text.ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4[ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4]+0xc4): undefined reference to fann_set_callback' xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[_ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_]+0xda): undefined reference to fann_set_callback'
/tmp/ccIST7S8.o: In function FANN::neural_net::print_parameters()': xor_sample.cpp:(.text._ZN4FANN10neural_net16print_parametersEv[_ZN4FANN10neural_net16print_parametersEv]+0x23): undefined reference to fann_print_parameters'
/tmp/ccIST7S8.o: In function FANN::neural_net::set_learning_rate(float)': xor_sample.cpp:(.text._ZN4FANN10neural_net17set_learning_rateEf[_ZN4FANN10neural_net17set_learning_rateEf]+0x2f): undefined reference to fann_set_learning_rate'
/tmp/ccIST7S8.o: In function FANN::neural_net::set_activation_function_hidden(FANN::activation_function_enum)': xor_sample.cpp:(.text._ZN4FANN10neural_net30set_activation_function_hiddenENS_24activation_function_enumE[_ZN4FANN10neural_net30set_activation_function_hiddenENS_24activation_function_enumE]+0x2b): undefined reference to fann_set_activation_function_hidden'
/tmp/ccIST7S8.o: In function FANN::neural_net::set_activation_function_output(FANN::activation_function_enum)': xor_sample.cpp:(.text._ZN4FANN10neural_net30set_activation_function_outputENS_24activation_function_enumE[_ZN4FANN10neural_net30set_activation_function_outputENS_24activation_function_enumE]+0x2b): undefined reference to fann_set_activation_function_output'
/tmp/ccIST7S8.o: In function FANN::neural_net::set_activation_steepness_hidden(float)': xor_sample.cpp:(.text._ZN4FANN10neural_net31set_activation_steepness_hiddenEf[_ZN4FANN10neural_net31set_activation_steepness_hiddenEf]+0x2f): undefined reference to fann_set_activation_steepness_hidden'
/tmp/ccIST7S8.o: In function FANN::neural_net::set_activation_steepness_output(float)': xor_sample.cpp:(.text._ZN4FANN10neural_net31set_activation_steepness_outputEf[_ZN4FANN10neural_net31set_activation_steepness_outputEf]+0x2f): undefined reference to fann_set_activation_steepness_output'
/tmp/ccIST7S8.o: In function FANN::neural_net::get_network_type()': xor_sample.cpp:(.text._ZN4FANN10neural_net16get_network_typeEv[_ZN4FANN10neural_net16get_network_typeEv]+0x2a): undefined reference to fann_get_network_type'
/tmp/ccIST7S8.o: In function FANN::neural_net::internal_callback(fann*, fann_train_data*, unsigned int, unsigned int, float, unsigned int)': xor_sample.cpp:(.text._ZN4FANN10neural_net17internal_callbackEP4fannP15fann_train_datajjfj[_ZN4FANN10neural_net17internal_callbackEP4fannP15fann_train_datajjfj]+0x37): undefined reference to fann_get_user_data'
collect2: error: ld returned 1 exit status

Thank you,
Raj Kamal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions