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

unresolved external symbol
http://forum.alglib.net/viewtopic.php?f=2&t=567
Page 1 of 1

Author:  PeterKottas [ Sat Apr 21, 2012 2:58 pm ]
Post subject:  unresolved external symbol

Hello everybody. I am new here and I just started experimenting with this library. There seem to be a lot of great function included but i struggle to get it running properly. Following chunk of code:

#include "StdAfx.h"
#include <windows.h>
#include "fundamental.h"
#include "matrix.h"
#include <cmath>

#include "ap.h"
#include "linalg.h"
#include "alglibinternal.h"

#include <iostream>
#include <fstream>
#include <cstdlib>

.
.
.

count =12;
alglib::real_2d_array a;
a.setlength(count,9) ;

for ( int i = 0; i < count; i++ )
{
for ( int j = 0; j < 9; j++ )
{
a(i,j) = mat[i][j];
}
}

alglib::ae_int_t m=count;
alglib::ae_int_t n=9;
alglib::ae_int_t uneeded=2;
alglib::ae_int_t vtneeded=2;
alglib::ae_int_t additionalmemory=2;
alglib::real_1d_array w;
alglib::real_2d_array u;
alglib::real_2d_array vt;

alglib::rmatrixsvd(a,m,n,uneeded,vtneeded,additionalmemory,w,u,vt);

.
.
.

Gives me linker errors:

Error 14 fatal error LNK1120: 9 unresolved externals

for instance :

Error 7 error LNK2001: unresolved external symbol "void __clrcall alglib_impl::hqrndunit2(struct alglib_impl::hqrndstate *,double *,double *,struct alglib_impl::ae_state *)" (?hqrndunit2@alglib_impl@@$$FYMXPAUhqrndstate@1@PAN1PAUae_state@1@@Z) linalg.obj

All these errors comes from linalg.obj as mentioned in output window.

I am using visual studio 2008 , c++ , where i added ap.h, linalg.h,alglibinternal.h and ap.cpp, linalg.cpp,alglibinternal.cpp to my project (right click header files -> add->existing file ... ). Is there some other step that I am forgetting about?

Author:  PeterKottas [ Sat Apr 21, 2012 4:09 pm ]
Post subject:  Re: unresolved external symbol

I just figured it out. It needed one additional "alglibmisc.h" header. It might be good idea to include these required references in each section in manual. For example if I found SVD in manual it would have following headers listed:
#include "ap.h"
#include "linalg.h"
#include "alglibinternal.h"
#include "alglibmisc.h"

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