Discussion:
Fann in C++ builder using dll libary
lukasz p.
2007-09-09 07:22:48 UTC
Permalink
Hi
I want to make application using FANN library, but i have problem using it
in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
View this message in context: http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12475265
Sent from the fann-general mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
kgantchev
2007-09-09 16:17:26 UTC
Permalink
I'm not sure I can help you with C++ builder, but I have set-up and ran a C++
project with the FANN library in Microsoft Visual Studio 2005. I suppose
it's similar, since you have to set up the projects similarly.
For more information visit the FANN forum and in particular my posting for
more information on libraries and include directories:
http://leenissen.dk/fann/forum/viewtopic.php?t=190&start=0&postdays=0&postorder=asc&highlight=

Comment there and let me know where you're stuck in particular; please post
particular questions, even if you think they're "dumb", it will help me
answer your better.
Post by lukasz p.
I want to make application using FANN library, but i have problem using it
in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
View this message in context: http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12580316
Sent from the fann-general mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lukasz p.
2007-09-14 05:48:52 UTC
Permalink
There was a problem with linking library but i finaly do it (need some
conversion) now i have another problem. On the beginig i have tried to build
xor sample. I'm using fannfloat.dll and in my project fannfloat.lib.

Here is my code (the same as it is on FANN site):

#include "fann.h"

int main()
{
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 3;
const float desired_error = (const float) 0.001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;

struct fann *ann = fann_create_standard(num_layers, num_input,
num_neurons_hidden, num_output);

fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);

fann_train_on_file(ann, "xor.data", max_epochs, epochs_between_reports,
desired_error);

fann_save(ann, "xor_float.net");

fann_destroy(ann);
return 0;
}


and here is my errors:
Build
[Linker Error] Unresolved external '_fann_set_activation_function_hidden'
referenced from C:\ BUILDER\\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_set_activation_function_output'
referenced from C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_train_on_file' referenced from C:\
BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_save' referenced from C:\
BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_destroy' referenced from C:\
BUILDER\XOR_1_2.OBJ

version of fann.h is 1.2 but i have also tried 2.0 and 2.1 and they doesn't
work to.
Post by kgantchev
I'm not sure I can help you with C++ builder, but I have set-up and ran a
C++ project with the FANN library in Microsoft Visual Studio 2005. I
suppose it's similar, since you have to set up the projects similarly.
For more information visit the FANN forum and in particular my posting for
http://leenissen.dk/fann/forum/viewtopic.php?t=190&start=0&postdays=0&postorder=asc&highlight=
Comment there and let me know where you're stuck in particular; please
post particular questions, even if you think they're "dumb", it will help
me answer your better.
Post by lukasz p.
I want to make application using FANN library, but i have problem using
it in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
View this message in context: http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12668926
Sent from the fann-general mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
kgantchev
2007-09-14 07:27:30 UTC
Permalink
1. You will probably need to set up the C++ preprocessor with FANN_NO_DLL
I did this for the latest fann C++ wrappers and it worked fine for me...
2. Are you trying to use the C++ wrappers?
If yes, then these are the headers I used with the latest C++ wrappers (2.1
I believe):

#include <iostream>
#include "floatfann.h"
#include "fann_cpp.h"
Currently it seems that you're trying to use the C version.

3. If you're using the 2.1 C++ Wrappers then you should run the
xor_sample.cpp
Post by lukasz p.
There was a problem with linking library but i finaly do it (need some
conversion) now i have another problem. On the beginig i have tried to
build xor sample. I'm using fannfloat.dll and in my project fannfloat.lib.
#include "fann.h"
int main()
{
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 3;
const float desired_error = (const float) 0.001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;
struct fann *ann = fann_create_standard(num_layers, num_input,
num_neurons_hidden, num_output);
fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);
fann_train_on_file(ann, "xor.data", max_epochs,
epochs_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
Build
[Linker Error] Unresolved external '_fann_set_activation_function_hidden'
referenced from C:\ BUILDER\\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_set_activation_function_output'
referenced from C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_train_on_file' referenced from
C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_save' referenced from C:\
BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_destroy' referenced from C:\
BUILDER\XOR_1_2.OBJ
version of fann.h is 1.2 but i have also tried 2.0 and 2.1 and they
doesn't work to.
Post by kgantchev
I'm not sure I can help you with C++ builder, but I have set-up and ran a
C++ project with the FANN library in Microsoft Visual Studio 2005. I
suppose it's similar, since you have to set up the projects similarly.
For more information visit the FANN forum and in particular my posting
http://leenissen.dk/fann/forum/viewtopic.php?t=190&start=0&postdays=0&postorder=asc&highlight=
Comment there and let me know where you're stuck in particular; please
post particular questions, even if you think they're "dumb", it will help
me answer your better.
Post by lukasz p.
I want to make application using FANN library, but i have problem using
it in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
View this message in context: http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12670013
Sent from the fann-general mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lukasz p.
2007-09-15 13:52:20 UTC
Permalink
I wanted to run console application using dll in c++ builder.
I wasn't using any c++ warppers, do I have to use it if i wanted to use dll
file in c++ ?
Post by kgantchev
1. You will probably need to set up the C++ preprocessor with FANN_NO_DLL
I did this for the latest fann C++ wrappers and it worked fine for me...
2. Are you trying to use the C++ wrappers?
If yes, then these are the headers I used with the latest C++ wrappers
#include <iostream>
#include "floatfann.h"
#include "fann_cpp.h"
Currently it seems that you're trying to use the C version.
3. If you're using the 2.1 C++ Wrappers then you should run the
xor_sample.cpp
Post by lukasz p.
There was a problem with linking library but i finaly do it (need some
conversion) now i have another problem. On the beginig i have tried to
build xor sample. I'm using fannfloat.dll and in my project
fannfloat.lib.
#include "fann.h"
int main()
{
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 3;
const float desired_error = (const float) 0.001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;
struct fann *ann = fann_create_standard(num_layers, num_input,
num_neurons_hidden, num_output);
fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);
fann_train_on_file(ann, "xor.data", max_epochs,
epochs_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
Build
[Linker Error] Unresolved external '_fann_set_activation_function_hidden'
referenced from C:\ BUILDER\\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_set_activation_function_output'
referenced from C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_train_on_file' referenced from
C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_save' referenced from C:\
BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_destroy' referenced from C:\
BUILDER\XOR_1_2.OBJ
version of fann.h is 1.2 but i have also tried 2.0 and 2.1 and they
doesn't work to.
Post by kgantchev
I'm not sure I can help you with C++ builder, but I have set-up and ran
a C++ project with the FANN library in Microsoft Visual Studio 2005. I
suppose it's similar, since you have to set up the projects similarly.
For more information visit the FANN forum and in particular my posting
http://leenissen.dk/fann/forum/viewtopic.php?t=190&start=0&postdays=0&postorder=asc&highlight=
Comment there and let me know where you're stuck in particular; please
post particular questions, even if you think they're "dumb", it will
help me answer your better.
Post by lukasz p.
I want to make application using FANN library, but i have problem using
it in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
View this message in context: http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12690461
Sent from the fann-general mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Steffen Nissen
2007-09-15 14:08:38 UTC
Permalink
Hi,

I believe that the dll have been made with MSVC++, so perhaps this is might
not fit well with C++ Builder.

There exists a C++ Builder project which should be able to make Borland .lib
files, which could be included in a C++ Builder project. Another way of
doing this, which I usually recommend for people who are having problems
with the dll's, is to simply include the files in the project that you are
building. This have been made very convenient for you, since you only need
to include the floatfann.c or the doublefann.c files in your project, and
let that compile along with your code. The FANN library is written in C, but
there should be no problems compiling it from C++.

Best Regards,
Steffen
Post by lukasz p.
I wanted to run console application using dll in c++ builder.
I wasn't using any c++ warppers, do I have to use it if i wanted to use dll
file in c++ ?
Post by kgantchev
1. You will probably need to set up the C++ preprocessor with FANN_NO_DLL
I did this for the latest fann C++ wrappers and it worked fine for me...
2. Are you trying to use the C++ wrappers?
If yes, then these are the headers I used with the latest C++ wrappers
#include <iostream>
#include "floatfann.h"
#include "fann_cpp.h"
Currently it seems that you're trying to use the C version.
3. If you're using the 2.1 C++ Wrappers then you should run the
xor_sample.cpp
Post by lukasz p.
There was a problem with linking library but i finaly do it (need some
conversion) now i have another problem. On the beginig i have tried to
build xor sample. I'm using fannfloat.dll and in my project
fannfloat.lib.
#include "fann.h"
int main()
{
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 3;
const float desired_error = (const float) 0.001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;
struct fann *ann = fann_create_standard(num_layers, num_input,
num_neurons_hidden, num_output);
fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);
fann_train_on_file(ann, "xor.data", max_epochs,
epochs_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
Build
[Linker Error] Unresolved external
'_fann_set_activation_function_hidden'
Post by lukasz p.
Post by kgantchev
Post by lukasz p.
referenced from C:\ BUILDER\\XOR_1_2.OBJ
[Linker Error] Unresolved external
'_fann_set_activation_function_output'
Post by lukasz p.
Post by kgantchev
Post by lukasz p.
referenced from C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_train_on_file' referenced from
C:\ BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_save' referenced from C:\
BUILDER\XOR_1_2.OBJ
[Linker Error] Unresolved external '_fann_destroy' referenced from C:\
BUILDER\XOR_1_2.OBJ
version of fann.h is 1.2 but i have also tried 2.0 and 2.1 and they
doesn't work to.
Post by kgantchev
I'm not sure I can help you with C++ builder, but I have set-up and ran
a C++ project with the FANN library in Microsoft Visual Studio 2005. I
suppose it's similar, since you have to set up the projects similarly.
For more information visit the FANN forum and in particular my posting
http://leenissen.dk/fann/forum/viewtopic.php?t=190&start=0&postdays=0&postorder=asc&highlight=
Post by lukasz p.
Post by kgantchev
Post by lukasz p.
Post by kgantchev
Comment there and let me know where you're stuck in particular; please
post particular questions, even if you think they're "dumb", it will
help me answer your better.
Post by lukasz p.
I want to make application using FANN library, but i have problem using
it in C++ builder.
Does anybody have working code in c++ builder with dll library?
I'm newbie to all of this and I want to start from simple project.
I would be greatful for any code, that can help me.
What to add and how to use.
I found dlls and *.lib files but i dont have idea what to do with this.
--
http://www.nabble.com/Fann-in-C%2B%2B-builder-using-dll-libary-tf4376740.html#a12690461
Post by lukasz p.
Sent from the fann-general mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fann-general mailing list
https://lists.sourceforge.net/lists/listinfo/fann-general
--
Steffen Nissen - http://MySpace.com/SteffenNissen
Project Administrator - Fast Artificial Neural Network Library (FANN)
http://leenissen.dk/fann/
Loading...