Discussion:
Compiling FANN samples
Luis Henrique Terbeck Pinto
2009-08-23 01:01:02 UTC
Permalink
Hello,

i have included fann to my c++ library, but trying to compile some
samples from the FANN webpage some errors have been passed:

The program i am compiling can be see below:

#include "fann.h"
int main()
{
const float connection_rate = 1;
const float learning_rate = 0.7;
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 4;
const float desired_error = 0.0001;
const unsigned int max_iterations = 500000;
const unsigned int iterations_between_reports = 1000;
struct fann *ann = fann_create(connection_rate, learning_rate,
num_layers, num_input, num_neurons_hidden, num_output);
fann_train_on_file(ann, "xor.data", max_iterations,
iterations_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}

and the terminal output:

***@debian:~/fann$ gcc fann.cpp -o fann
fann.cpp: In function ‘int main()’:
fann.cpp:14: warning: deprecated conversion from string constant to
‘char*’
/tmp/ccuBJ32n.o: In function `main':
fann.cpp:(.text+0x85): undefined reference to `fann_create'
fann.cpp:(.text+0xb5): undefined reference to `fann_train_on_file'
fann.cpp:(.text+0xc8): undefined reference to `fann_save'
fann.cpp:(.text+0xd3): undefined reference to `fann_destroy'
/tmp/ccuBJ32n.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

If someone can help, it would be gratefull.

Regards,

LHP
Steffen Nissen
2009-08-25 16:01:44 UTC
Permalink
Please remember to link to FANN.

gcc fann.cpp -l fann -o fann

Best Regards,
Steffen Nissen, MSc
http://www.linkedin.com/in/steffennissen
Post by Luis Henrique Terbeck Pinto
Hello,
i have included fann to my c++ library, but trying to compile some
#include "fann.h"
int main()
{
const float connection_rate = 1;
const float learning_rate = 0.7;
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 4;
const float desired_error = 0.0001;
const unsigned int max_iterations = 500000;
const unsigned int iterations_between_reports = 1000;
struct fann *ann = fann_create(connection_rate, learning_rate,
num_layers, num_input, num_neurons_hidden, num_output);
fann_train_on_file(ann, "xor.data", max_iterations,
iterations_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
fann.cpp:14: warning: deprecated conversion from string constant to
‘char*’
fann.cpp:(.text+0x85): undefined reference to `fann_create'
fann.cpp:(.text+0xb5): undefined reference to `fann_train_on_file'
fann.cpp:(.text+0xc8): undefined reference to `fann_save'
fann.cpp:(.text+0xd3): undefined reference to `fann_destroy'
/tmp/ccuBJ32n.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
If someone can help, it would be gratefull.
Regards,
LHP
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Fann-general mailing list
https://lists.sourceforge.net/lists/listinfo/fann-general
Luis Henrique Terbeck Pinto
2009-08-26 01:15:02 UTC
Permalink
Yeah .. it works!! Sorry for so elementar question.

Thanks for the help.

Regards.

Luis H.
Post by Steffen Nissen
Please remember to link to FANN.
gcc fann.cpp -l fann -o fann
Best Regards,
Steffen Nissen, MSc
http://www.linkedin.com/in/steffennissen
Hello,
i have included fann to my c++ library, but trying to compile some
#include "fann.h"
int main()
{
const float connection_rate = 1;
const float learning_rate = 0.7;
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 4;
const float desired_error = 0.0001;
const unsigned int max_iterations = 500000;
const unsigned int iterations_between_reports = 1000;
struct fann *ann = fann_create(connection_rate, learning_rate,
num_layers, num_input, num_neurons_hidden, num_output);
fann_train_on_file(ann, "xor.data", max_iterations,
iterations_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
fann.cpp:14: warning: deprecated conversion from string constant to
‘char*’
fann.cpp:(.text+0x85): undefined reference to `fann_create'
fann.cpp:(.text+0xb5): undefined reference to
`fann_train_on_file'
fann.cpp:(.text+0xc8): undefined reference to `fann_save'
fann.cpp:(.text+0xd3): undefined reference to `fann_destroy'
/tmp/ccuBJ32n.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
If someone can help, it would be gratefull.
Regards,
LHP
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment
- and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Fann-general mailing list
https://lists.sourceforge.net/lists/listinfo/fann-general
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
Loading...