![]() |
|
#1
|
|||
|
|||
ANN library with BCC55Hello everyone,
I am working on project that need an optimal nearest neighbour search algorithm and I wanted to use both exact and approximate algorithms in order to compare the best one for my prblem, However ANN provide them by download ANN library that is already written in c++. So does anyone know if Borland support the ANN library or may be know how can I add this library from "his experience "I thank you in advance for any kind of help. S H E R E E |
|||
|
#2
|
|||
|
|||
Re: ANN library with BCC55Quote:
[disclaimer] The following works for me with Borland C++ version 5.5.1 on my Windows XP platrorm. Your mileage may vary. [/disclaimer] I use command-line for everything. If you have Borland bcc32 version 5.5.1, here's a way: Download ann_1.1.1 from http://www.cs.umd.edu/~mount/ANN/ Uncompress it, so you have a directory tree starting at ann_1.1.1 (See Footnote.) Go into the ann_1.1.1\src directory. Rename the Makefile in that directory to something else, just so you will have it as a reference (Maybe something like Makefile.original) Past the following into your text editor and save it as Makefile: Code:
Note that if your Borland compiler is not installed at "C:\Borland\bcc55", change the definition of BORLANDDIR in the Makefile. Assuming that the Borland binary directory is on your PATH, then just execute "make" from the command line. (If it's not on the path, then either put it there, or use the entire path name on the command line. Like "C:\borland\bcc55\bin\make", or whatever...) There may be lots of warnings about stuff not being expanded inline. Ignore these warnings. If it runs OK, then there will be a file named ANN.lib in the ann_1.1.1\lib directory. Now cd into the ann_1.1.1\test directory. Rename the Makefile in that directory to something like Makefile.original. Paste the following into a text window and save as Makefile: Code:
Now run make from this directory. If everything has been OK up until now, you should have a file named ann_test.exe in that directory. Execute the following from the command line: Code:
It creates a file named test1.out. The contents of test1.out should be something like the following: Code:
Read the documentation file ANNmanual.pdf. Create your own project file at one level below ann_1.1.1 and use the Makefile from the test directory as a model to create your own project. Note that the Makefiles that I used do not have headers as dependencies. If you change any of the headers, then do make clean before doing a new make. Regards, Dave Footnote: I strongly recommend that you make a project file far and away from any Windows installation or Borland installation or any other system directories. For example make a directory named C:\Projects. (Actually, I always have a different disk partition that is different from C:, but that's another story.) Then download your ann_1.1.1.tar.gz to the \Projects directory. Since I do everything from a command line, I never, ever (really, not ever) make a directory or file name with spaces in it. You can do what you want, but I just thought I would put it out there for your consideration. |
|
#3
|
|||
|
|||
Re: ANN library with BCC55What is ann package all about ?
Thanks for your help. |
|
#4
|
|||
|
|||
Re: ANN library with BCC55Hello,
thanks a lot for the help, but actaully I could you explaine: first,where should I uncompress the file ann_1.1.1 ? I tried all what you said and I put ann_1.1.1 in another directory, and went to the directory C:\BCC55, because it is my directory and there I typed " make" and every thing is okay but then I haven't got any "ANN.lib in the ann_1.1.1\lib directory" at all and "ann_1.1.1\lib directory , ann_1.1.1\bin directory" are empty as well. By the way I didn't put the new Makefile in the C:\BCC55\bin and in this directory I have other make, could that cause a confusion .....in typing just make in C:\BCC55\bin directory. I'll appreciate any more detail. thanks. |
|
#5
|
|||
|
|||
Re: ANN library with BCC55Quote:
What I said before: Quote:
I'm not sure exactly where I went wrong in the instructions, but I will try again... Some amplification: I would create a directory named \Projects. I would download the tarball file to the \Projects directory and expand it there. (Since you have already downloaded it, just copy it to the \Projects directory.) So, after expanding it, you will have everything in \Projects\ann_1.1.1 Then cd into \Projects\ann_1.1.1\src and put the Makefile that I suggested in \Projects\ann_1.1.1\src. Inside the Makefile, change the BORLANDDIR assignment to correspond to your bcc55 installation directory: Code:
Code:
Regards, Dave |
|
#6
|
|||
|
|||
Re: ANN library with BCC55Aha, I see now.
now I think I did the right but during the execute, I have got this error message: /*********************************************/ >make MAKE Version 5.2 Copyright (c) 1987, 2000 Borland C:\BCC55\bin\bcc32 -IC:\BCC55\include -LC:\BCC55\lib -c -I..\include -DANN_NO_RANDOM -DANN_NO_LIMITS_H -DPERF brute.cpp Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland brute.cpp: Warning W8017 C:\BCC55\include\ANN/ANN.h 108: Redefinition of 'DBL_MAX' is not identical Error E2451 C:\BCC55\include\ANN/ANNperf.h 95: Undefined symbol 'ANN_DBL_MAX' in function ANNsampStat::reset() Error E2451 pr_queue_k.h 46: Undefined symbol 'ANN_DIST_INF' Warning W8027 pr_queue_k.h 105: Functions containing for are not expanded inline Warning W8057 brute.cpp 78: Parameter 'eps' is never used in function ANNbruteForce::annkSearch(double *,int,int *,double *,double) Warning W8057 brute.cpp 109: Parameter 'eps' is never used in function ANNbruteForce::annkFRSearch(double *,double,int,int *,double *,double) *** 2 errors in Compile *** /*********************************************/ Do you know, how can I handle such errors Thanks |
|
#7
|
|||
|
|||
Re: ANN library with BCC55Quote:
1. You have a directory named C:\bcc55\include\ANN. If you had done what I suggested, it wouldn't be there. If that is left over from your previous attempts, then delete it (and any other stuff under C:\bcc55 that you have added.) I respectfully suggest that you keep everything out of and away from your bcc55 directories. (At least until you have built it successfully.) 2. Clean out (delete) everything except the tarball file in all directories that you have previously created for your ANN efforts. Delete the directories, too. 3. Repeat the steps I suggested in my previous posts: (Create a brand new \Projects directory, etc.) Here are the first couple of lines that my make created: Code:
We are apparently working with the same version of compiler and make programs. I am also assuming that you are using the same version of ann_1.1.1.tar.gz, obtained from the site that I mentioned. If this is so, then I can't see why yours would be different (other than the exact path to bcc32 and the borland include and library files). See Footnote. As I mentioned before, the warnings are innocuous, and can be ignored, but there should be no errors. Regards, Dave Footnote: Here are lines 108-115 of ANN.h: CPP / C++ / C Code:
What do these lines of ANN.h look like in your distribution? |
|
#8
|
|||
|
|||
Re: ANN library with BCC55I deleted every thing and I do the following:
1. create new directory C:\project 2. put ann_1.1.1 in C:\project 3. went to C:\project\ann_1.1.1\scr modify Makefile 4. past yours Makefile in it " and I changed the directory to C:\BCC55 as I have" 5. from C:\project\ann_1.1.1\scr directory execute C:\BCC55\bin\make but I have two errors........:-( Yes, exactly the main problem in that part of the library you mensioned: I have got those lines: #include <cvalues> // replacement for limits.h const double ANN_DBL_MAX = maxdouble; // insert maximum double#else #include <climits> #include <cfloat> const double ANN_DBL_MAX = DBL_MAX; #endif the colored line is 114 of ANN.h So, Irepeated everything as you recommand. When I go to the directory C:\projects\ann_1.1.1\src and execute C:\BCC55\bin\make I have two errors: C:\project\ann_1.1.1>cd src C:\project\ann_1.1.1\src>C:\BCC55\Bin\make MAKE Version 5.2 Copyright (c) 1987, 2000 Borland C:\BCC55\bin\bcc32 -IC:\BCC55\include -LC:\BCC55\lib -c -I..\include -DA NN_NO_RANDOM -DANN_NO_LIMITS_H -DPERF ANN.cpp Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland ANN.cpp: Error E2209 ..\include\ANN/ANN.h 109: Unable to open include file 'cvalues' Error E2451 ..\include\ANN/ANN.h 110: Undefined symbol 'MAXDOUBLE' *** 2 errors in Compile *** ** error 1 ** deleting ANN.obj but if I just execute from the following directory: C:\project\ann_1.1.1\> the I have the following result: C:\project\ann_1.1.1>C:\BCC55\Bin\make MAKE Version 5.2 Copyright (c) 1987, 2000 Borland "Enter one of the following:" " make linux-g++ for Linux and g++" " make macosx-g++ for Mac OS X and g++" " make sunos5 for Sun with SunOS 5.x" " make sunos5-sl for Sun with SunOS 5.x, make shared libs" " make sunos5-g++ for Sun with SunOS 5.x and g++" " make sunos5-g++-sl for Sun with SunOS 5.x, g++, make shared libs" " make clean remove .o files" " make realclean remove .o, library and executable files" " " "See file Makefile for other compilation options, such as disabling" "performance measurement code." and I tried "make clean" from the directory: C:\project\ann_1.1.1>make clean and the output looks like that: MAKE Version 5.2 Copyright (c) 1987, 2000 Borland cd src ; make clean ** error -1 ** deleting clean while from the directory: C:\project\ann_1.1.1\src>make clean the output looks like: MAKE Version 5.2 Copyright (c) 1987, 2000 Borland And then I tried some other tricks, so I just copied the ANN file that contains the header files into the C.\BCC55\include directory and I tested the "ann_sample.cpp" code that is exist in the C:\project\ann_1.1.1\sample and I compiled it, the result has one error that related to the same line "114" like that bcc32 -v- -w -O1 ann_sample.cpp Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland ann_sample.cpp: Error E2451 C:\BCC55\INCLUDE\ANN/ANN.h 114: Undefined symbol '_max_dble' *** 1 errors in Compile *** what was strange , the green symbol is not exist ......but the error points to the red line 114 W H A T D O Y O U T H I N K ?? |
|
#9
|
|||
|
|||
Re: ANN library with BCC55Quote:
So, let's try an experiment. Make a new directory named \Projects\testcvalues. Paste the following into your text editor and save it as testcvalues.cpp in that directory. Compile it from a command line prompt in that directory. CPP / C++ / C Code:
If it doesn't complain about <iostream>, but gives an error message about not finding <cvalues>, then let's try something else. Modify the testcvalues.cpp file as follows: CPP / C++ / C Code:
Now, what happens? If you get a successful compile, then execute the program. Here's what I see: Code:
If you get it this time, then rejoice! We are almost done. (I hope that those don't become "famous last words.") Go back to the ANN src directory and edit the Makefile that I supplied. Change the ANNDEFS line to Code:
Now, here is the part I was trying to avoid: Because of a quirky little "feature" of this particular Borland <cfloat> file, it won't use _max_dble unless you specifically tell it with something like the using std::_max_dble line in the test program. Edit the ann_1.1.1\ANN\ANN.h as follows: You need to put using std::_max_dble; just before it defines ANN_DBL_MAX. So, now lines 108-116 will look like: CPP / C++ / C Code:
Now execute C:\BCC55\bin\make clean and C:\BCC55\bin\make Let me know how it goes. (If this works, then note that you must change the ANNDEFS line in test\Makefile the same way that you did in the src\Makefile.) Regards, Dave Footnote: My bcc55 installation has a file named cvalues.h in its bcc55\include directory and it is possible that yours does not. If so, then I'm sorry it took so long to get around to it. Not all compilers have this particular file, and, in fact I have seen some distributions with what appears to be the same version number but with minor variations in some of the files. If ANN works with the changes I made here, don't change your BCC55 installation, just go forward. Don't look back. "Don't look back. Something may be gaining on you." ---Satchel Paige Last edited by davekw7x : 01-Apr-2008 at 17:41.
|
|
#10
|
|||
|
|||
Re: ANN library with BCC55Hyeeeeeeeeeeeeeeeeeeeeeeeee we win,
thanks davekw7x, you are absolutely right, now I have got it The problem was exactly "cvalues" now everything is working well and I tried the "ann" library with my project as well, it is wonderful The last experience evaluated the problem precisely ![]() |
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| News:E-XD++ MFC Library Professional Edition V9.20 is released (100% Source | jackonlyone | Member Announcements, Advertisements & Offers | 0 | 07-Mar-2006 21:04 |
| Bloodshed Dev C++ Project Options | JdS | C++ Forum | 6 | 11-Nov-2005 17:23 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The