473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

unresolved externals when execute the programming

1
halo.. i face problem when i execute the programming.

it appear the error as :
1.obj : error LNK2001: unresolved external symbol "double __cdecl NR::trapzd(double (__cdecl*)(double),double,double,int)" (?trapzd@NR@@YANP6ANN@ZNNH@Z)
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

can anyone help me ? thanks in advance .

below is the programming :

#include <iostream>
#include<iomanip>
#include<cmath>
# include<math.h>
#include<fstream>
#include "nr.h"
# include<stdio.h>
# include <stdio.h>
/*ifndef _NR_UTIL_H_
#define _NR_UTIL_H_
#include <string>
#include <cmath>
#include <complex>
#include<fstream>
#include <iostream>*/
using namespace std;

// Driver for routine trapzd
DP func(const DP x)
{ return (x*x)*(x*x-2.0)*sin(x);
}

DP fint(const DP x)
{ return 4.0*x*(x*x-7.0)*sin(x)-(pow(x,4.0)-14.0*(x*x)+28.0)*cos(x);
}

DP trapzd(DP func(const DP), const DP a, const DP b, const int n)
{ DP x,tnm,sum,del;
static DP s;
int it,j;

if(n==1)
{ return s=0.5*(b-a)*(func(a)+func(b));
}
else {
for(it=1,j=1;j<n-1;j++)

tnm=it;
del=(b-a)/tnm;
x=a+0.5*del;
for(sum=0.0,j=0;j<it;j++,x+=del)

s=0.5*(s+(b-a)*sum/tnm);
return s;
}
}
int main (void)
{ const int NMAX=14;
const DP PI02=1.570796326794896619;
int i;
DP a=0.0, b=PI02,s;

cout<<" Integral the function with 2^(n-1) points" <<endl;
cout<<" Actual value of intgral is"<< setw(10)<<(fint(b)-fint(a))<<endl;
cout<<setw(6)<<"n"<< setw(24)<<"approximate integral"<<endl;
cout<< fixed << setprecision(6);
for(i=0;i<NMAX;i++)
{ s=NR::trapzd(func,a,b,i);

cout<<setw(6)<<(i+1)<<setw(20)<<s<<endl;
}
return 0;
}
Mar 16 '08 #1
1 1365
Check the differences between the declaration and the two calls.
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. DP trapzd(DP func(const DP), const DP a, const DP b, const int n)
  4.  
  5.  
  6. s=NR::trapzd(func,a,b,i);
  7.  
  8. s=NR::trapzd(func(const DP),a,b,i);
  9.  
The top one is coming back undefined because the linker is expecting a value to be passed to the function.

--

The one and only.... -- Uh, What am I again?
Mar 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Rodolphe | last post by:
Hello, I'm French so sorry for my approximate English. When I try to compile a project under Visual C++ 6.0, I've got the following errors : applicap.obj : error LNK2001: unresolved external...
0
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString...
0
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.