Hi to all,
-I am a total newbie for C++ in general. I wanted to install ALGLIB under Codeblocks, but I made clearly a mistake I am not able to find.
Under Windows 10,
I installed "codeblocks-16.01mingw-setup" under the C:/codeblocks dir.
Then I extracted "alglib-3.10.0.cpp.gpl" to a dir that I called "C:\clibs\prova4".
I created a c++ project named prova4 in the dir "C:\clibs\prova4"
my dirlist is :
Directory di C:\clibs\prova4
07/09/2016 19:32 <DIR> .
07/09/2016 19:32 <DIR> ..
07/09/2016 18:45 1,851,664 alglibinternal.cpp
06/09/2016 14:09 36,101 alglibinternal.h
06/09/2016 14:09 183,193 alglibmisc.cpp
06/09/2016 14:09 49,863 alglibmisc.h
06/09/2016 14:09 324,544 ap.cpp
06/09/2016 14:09 60,142 ap.h
07/09/2016 19:16 <DIR> bin
06/09/2016 14:09 1,307,516 dataanalysis.cpp
06/09/2016 14:09 307,205 dataanalysis.h
06/09/2016 14:09 39,430 diffequations.cpp
06/09/2016 14:09 9,823 diffequations.h
06/09/2016 14:09 118,494 fasttransforms.cpp
06/09/2016 14:09 25,643 fasttransforms.h
06/09/2016 14:09 136,763 integration.cpp
06/09/2016 14:09 31,907 integration.h
06/09/2016 14:09 1,343,313 interpolation.cpp
06/09/2016 14:09 307,623 interpolation.h
06/09/2016 14:09 1,557,964 linalg.cpp
06/09/2016 14:09 334,967 linalg.h
07/09/2016 19:07 956 lista.txt
07/09/2016 19:32 553 main.cpp
07/09/2016 19:16 <DIR> obj
06/09/2016 14:09 1,378,551 optimization.cpp
06/09/2016 14:09 277,932 optimization.h
07/09/2016 19:23 1,145 prova4.cbp
07/09/2016 19:23 357 prova4.layout
06/09/2016 14:09 500,564 solvers.cpp
06/09/2016 14:09 170,881 solvers.h
06/09/2016 14:09 291,595 specialfunctions.cpp
06/09/2016 14:09 63,975 specialfunctions.h
06/09/2016 14:09 611,974 statistics.cpp
06/09/2016 14:09 56,959 statistics.h
06/09/2016 14:09 4 stdafx.h
31 File 11,381,601 byte
4 Directory 18,978,639,872 byte disponibili
I instructed the project linker in codeblocks to point to "C:\clibs\prova4".
my main.cpp code is:
Code:
#include <iostream>
#include <stdio.h>
#include "alglibinternal.h"
#include "alglibmisc.h"
#include <ap.h>
#include "dataanalysis.h"
#include "diffequations.h"
#include "fasttransforms.h"
#include "integration.h"
#include "interpolation.h"
#include "linalg.h"
#include "optimization.h"
#include "solvers.h"
#include "specialfunctions.h"
#include "statistics.h"
#include "stdafx.h"
using namespace std;
int main()
{
alglib::real_1d_array x;
x = "[1,2,3,4,5]";
// std::cout << "Hello world!" << std::endl;
return 0;
}
When I try to build it I get:
mingw32-g++.exe -Wall -fexceptions -g -IC:\clibs\prova4\ -IC:\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include -IC:\clibs\cpp\src -c C:\clibs\prova4\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\CodeBlocks\MinGW\lib\cpp\src -o bin\Debug\prova4.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/clibs/prova4/main.cpp:22: undefined reference to `alglib::real_1d_array::real_1d_array()'
C:/clibs/prova4/main.cpp:23: undefined reference to `alglib::real_1d_array::real_1d_array(char const*)'
C:/clibs/prova4/main.cpp:23: undefined reference to `alglib::real_1d_array::operator=(alglib::real_1d_array const&)'
C:/clibs/prova4/main.cpp:23: undefined reference to `alglib::real_1d_array::~real_1d_array()'
C:/clibs/prova4/main.cpp:26: undefined reference to `alglib::real_1d_array::~real_1d_array()'
C:/clibs/prova4/main.cpp:23: undefined reference to `alglib::real_1d_array::~real_1d_array()'
C:/clibs/prova4/main.cpp:26: undefined reference to `alglib::real_1d_array::~real_1d_array()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
8 error(s), 0 warning(s) (0 minute(s), 1 second(s)) When I change "ap.h" to ap.cpp I obtain:
-------------- Build: Debug in prova4 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -IC:\clibs\prova4\ -IC:\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include -IC:\clibs\cpp\src -c C:\clibs\prova4\main.cpp -o obj\Debug\main.o
In file included from C:\clibs\prova4\main.cpp:5:0:
C:\clibs\prova4/ap.cpp:143:17: warning: 'alglib_impl::_ae_bool_must_be_8_bits_wide' defined but not used [-Wunused-variable]
static char _ae_bool_must_be_8_bits_wide[1-2*((int)(sizeof(ae_bool))-1)*((int)(sizeof(ae_bool))-1)];
^
C:\clibs\prova4/ap.cpp:144:13: warning: 'alglib_impl::_ae_int32_t_must_be_32_bits_wide' defined but not used [-Wunused-variable]
static char _ae_int32_t_must_be_32_bits_wide[1-2*((int)(sizeof(ae_int32_t))-4)*((int)(sizeof(ae_int32_t))-4)];
^
C:\clibs\prova4/ap.cpp:145:13: warning: 'alglib_impl::_ae_int64_t_must_be_64_bits_wide' defined but not used [-Wunused-variable]
static char _ae_int64_t_must_be_64_bits_wide[1-2*((int)(sizeof(ae_int64_t))-8)*((int)(sizeof(ae_int64_t))-8)];
^
C:\clibs\prova4/ap.cpp:146:13: warning: 'alglib_impl::_ae_int_t_must_be_pointer_sized' defined but not used [-Wunused-variable]
static char _ae_int_t_must_be_pointer_sized [1-2*((int)(sizeof(ae_int_t))-(int)sizeof(void*))*((int)(sizeof(ae_int_t))-(int)(sizeof(void*)))];
^
mingw32-g++.exe -LC:\CodeBlocks\MinGW\lib\cpp\src -o bin\Debug\prova4.exe obj\Debug\main.o
Output file is bin\Debug\prova4.exe with size 1.46 MB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 4 warning(s) (0 minute(s), 3 second(s)) but if I insert a line:
Code:
alglib::samplemean(x);
I obtain:
------------- Build: Debug in prova4 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -IC:\clibs\prova4\ -IC:\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include -IC:\clibs\cpp\src -c C:\clibs\prova4\main.cpp -o obj\Debug\main.o
In file included from C:\clibs\prova4\main.cpp:5:0:
C:\clibs\prova4/ap.cpp:143:17: warning: 'alglib_impl::_ae_bool_must_be_8_bits_wide' defined but not used [-Wunused-variable]
static char _ae_bool_must_be_8_bits_wide[1-2*((int)(sizeof(ae_bool))-1)*((int)(sizeof(ae_bool))-1)];
^
C:\clibs\prova4/ap.cpp:144:13: warning: 'alglib_impl::_ae_int32_t_must_be_32_bits_wide' defined but not used [-Wunused-variable]
static char _ae_int32_t_must_be_32_bits_wide[1-2*((int)(sizeof(ae_int32_t))-4)*((int)(sizeof(ae_int32_t))-4)];
^
C:\clibs\prova4/ap.cpp:145:13: warning: 'alglib_impl::_ae_int64_t_must_be_64_bits_wide' defined but not used [-Wunused-variable]
static char _ae_int64_t_must_be_64_bits_wide[1-2*((int)(sizeof(ae_int64_t))-8)*((int)(sizeof(ae_int64_t))-8)];
^
C:\clibs\prova4/ap.cpp:146:13: warning: 'alglib_impl::_ae_int_t_must_be_pointer_sized' defined but not used [-Wunused-variable]
static char _ae_int_t_must_be_pointer_sized [1-2*((int)(sizeof(ae_int_t))-(int)sizeof(void*))*((int)(sizeof(ae_int_t))-(int)(sizeof(void*)))];
^
mingw32-g++.exe -LC:\CodeBlocks\MinGW\lib\cpp\src -o bin\Debug\prova4.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/clibs/prova4/main.cpp:24: undefined reference to `alglib::samplemean(alglib::real_1d_array const&)'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 3 second(s))
2 error(s), 4 warning(s) (0 minute(s), 3 second(s)) I've been struggling for days, but I think I need help, since this is my first c++ attempt..
thanks a lot..