Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error c2059... 1

Status
Not open for further replies.

aaadetos

Programmer
Nov 21, 2004
54
US
I have a couple of source files, which are to be executed in a single source file; On calling functions in other source files from the executing source file, I get the syntax error C2059.

The executing source file is shown below:
Code:
#include <math>
#include "stdafx.h"
#include "Kuchuk.h"
#include "KuchukDlg.h"
#include "homogeneous.h"
#include <iostream>
using namespace std;

double PI = 3.141592653589793238462643383279502884197;
float zw,zs;
double ghomo[1];
double gh;

static int K;

double homo(double phi_u[],double phi_d[],double v[],double H_ft[],float zw,float zs)
{
	CKuchukDlg MyClass;
	MyClass.m_iSLayer = K;
	MyClass.m_fZs = zs;
	MyClass.m_fZw = zw;

	double A[1],B[1],C[1];
	gh = 0.0;

	phi_u[K] = phiu(phi_u[],R[],v[],H_ft[]);//error C2059: syntax error: ']'
	phi_d[K] = phid(phi_d[],R[],v[],H_ft[]);//error C2059: syntax error: ']'


	
	A[K]= 1/(1-(phi_u[K]*phi_d[K]*exp(-2.0*v[K]*H_ft[K])));

	B[K]=(1+(phi_d[K]*exp(-2.0*v[K]*zw)))*(phi_u[K]*exp(-2*v[K]*zs));

	C[K]=(1+(phi_u[K]*exp(-2.0*v[K]*zs)))*(phi_d[K]*exp(-2*v[K]*zw));

	ghomo[K]=((PI/4.0)*A[K])*(B[K]+C[K]);

	gh += ghomo[K];

	return gh;
}
I don't understand why I get this error. The function prototypes have already been defined in the header file: "homogeneous.h", as:

Code:
extern double phiu(double phi_u[],double R[],double v[],double H_ft[]);

extern double phid(double phi_d[],double R[],double v[],double H_ft[]);


I'd appreciate any help. Thanks.
 
See R var declaration. Undeclared R (from prototype?) in homo body can mask the true cause of the problem.
Don't write args in function calls as array[]: write array name only...
 
Thanks a lot, ArkM!
I redefined the function prototype as:
Code:
double homo(double phi_u[],double phi_d[],double v[],double H_ft[],double R[],float zw,float zs)

AND removed the [], leaving only the array names.
...No ERRORS!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top