forum.alglib.net
http://forum.alglib.net/

Alglib error :"undefined reference to" in ubuntu with g++4.5
http://forum.alglib.net/viewtopic.php?f=2&t=425
Page 1 of 1

Author:  chengch [ Tue Aug 30, 2011 12:40 pm ]
Post subject:  Alglib error :"undefined reference to" in ubuntu with g++4.5

I'm new here and trying to make use of alglib.
The alg.net told me 'Adding ALGLIB to your project is easy - just pick packages you need and... add them to your project!!"
But I can't compile even a simplest example:
"
#include<stdio.h>
#include<iostream>
#include "specialfunctions.h"
#include "specialfunctions.cpp"

using namespace std;

int main () {

const double x = 2;
double y = alglib::besselj0(x);

cout << y << "\n";

return 0;
"
I got the errors:
"
undefined reference to `alglib_impl::namesoffunctions.
..
..
..
..
"
is there anyone who can help me ?

I first find this when i compile my codes (which could be successfully done under visual studio in Win7) under ubuntu with g++4.5.2.
So I write a simple test but still get only errors. I' have visited sevaral webs for this problem, and someone told me I should not only include .h but also .cpp files. But you see, it does not work.
Should someone knows why and tell me how to use this in linux?

Thanks a lot!

Author:  DiaG [ Sun Mar 04, 2012 5:17 pm ]
Post subject:  Re: Alglib error :"undefined reference to" in ubuntu with g+

I think, that you should add the paths to alglib's src in settings of compiler. In qt (but Windows) I'm add folder with source to project, and this error disappear

Author:  Sergey.Bochkanov [ Mon Mar 05, 2012 8:02 am ]
Post subject:  Re: Alglib error :"undefined reference to" in ubuntu with g+

Hello!

You should compile .cpp files instead of including them. Compile .cpp as a separate object file, include .h - and it should work. Also, you should compile all cpp files - not just ones you need.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/