forum.alglib.net

ALGLIB forum
It is currently Sat Sep 28, 2024 11:32 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Alglib error :"undefined reference to" in ubuntu with g++4.5
PostPosted: Tue Aug 30, 2011 12:40 pm 
Offline

Joined: Tue Aug 30, 2011 12:20 pm
Posts: 1
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!


Top
 Profile  
 
 Post subject: Re: Alglib error :"undefined reference to" in ubuntu with g+
PostPosted: Sun Mar 04, 2012 5:17 pm 
Offline

Joined: Sun Mar 04, 2012 5:11 pm
Posts: 1
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


Top
 Profile  
 
 Post subject: Re: Alglib error :"undefined reference to" in ubuntu with g+
PostPosted: Mon Mar 05, 2012 8:02 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 922
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group