473,394 Members | 1,829 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,394 software developers and data experts.

error: expression must have pointer-to-object type

5
Hi everyone,
I critically need help to solve this problem related to pointer in C++
Basically, I have a C/C++ program "retardselfenerg" calling a Fortran 90 subroutine "surfGF4.f90". i am so doubtful if my definitions of pointer variables and their use in calling function are correct.

#include<bla bla bla......h>
#include<bla bla bla.h>

double surfGF4_(double*, double*, double*, double*, double*, double*, double*, double*, double*);

void retardselfenerg(real d_omega, int len)
{
int i,j;
double sigm11,sigm12,sigm21,sigm22,sigmN_1N_1,sigmN_1N,si gmNN_1,sigmNN;
double *sigm11x = &sigm11;
double *sigm12x = &sigm12;
double *sigm21x = &sigm21;
double *sigm22x = &sigm22;
double *sigmN_1N_1x = &sigmN_1N_1;
double *sigmN_1Nx = &sigmN_1N;
double *sigmNN_1x = &sigmNN_1;
double *sigmNNx = &sigmNN;

double noisevarleft11, noisevarleft12, noisevarleft21, noisevarleft22, noisevarrightN_1N_1, noisevarrightN_1N, noisevarrightNN_1, noisevarrightNN;
double *noisevarleft11x = &noisevarleft11;
double *noisevarleft12x = &noisevarleft21;
...................................
..................................etc
noisevarrightNN_1x =&noisevarrightNN_1;
noisevarrightNNx = &noisevarrightNN;
FILE *out11, *out12, *out21, *out22, *outN_1N_1, *outN_1N, *outNN_1,
*outNN, *out11x, *out12x, *out21x, *out22x, *outN_1N_1x, *outN_1Nx, *outNN_1x, *outNNx;

double w, dw;
double k_B = 1;
double hbar = 0.06465;

fftw_complex *sigm11_w, *sigm11_t;
fftw_plan p;

out11 = fopen("self_left11.txt", "w");
out11x = fopen("noisevarleft11.txt", "w");

sigm11_w = (fftw_complex *) fftw_malloc(sizeof(fftw_complex) * len);
sigm11_t = (fftw_complex *) fftw_malloc(sizeof(fftw_complex) * len);

assert(sigm11_w != NULL);
assert(sigm11_t != NULL);
assert(len == length_FFT);

p = fftw_plan_dft_1d(len, sigm11_w, sigm11_t, FFTW_FORWARD, FFTW_ESTIMATE);

dw = 2.0*M_PI/(h*len);

for (i=0; i<len; i++)
{
w = i * dw;
for (j=0; j<2; ++j)
{
surfGF4_(w, sigm11x, sigm12x, sigm21x, sigm22x, sigmN_1N_1x, sigmN_1Nx, sigmNN_1x, sigmNNx);
/* sigm11[i][j] = *sigm11x[i][j]; */
*sigm11_w[i][j] = *sigm11x[i][j];
*noisevarleft11x[i][j] = - (pow(exp(hbar*w/(k_B*T_left))-1,-1) + 0.5)*hbar*h*len*(*sigm11x[i][j]);
}
fprintf(out11x, "%lf", noisevarleft11[i][1]);

}
......................
......................etc

The corresponding fortran 90 program looks something like this

subroutine surfGF4(w, sigm11, sigm12, sigm21, sigm22, sigmN_1N_1, sigmN_1N, sigmNN_1, sigmNN)

implicit none
........................
......................

real, dimension (1,2) :: sigm11, sigm12, sigm21, sigm22, sigmN_1N_1, sigmN_1N, sigmNN_1, sigmNN
......................etc

It is necessary to know something about FFTW (fastest fourier transform in the west) library function in this case.
I use SSH and linux icc compiler to compile this program but I get this error in compilation

GlobalRev.c(1313): error: argument of type "double" is incompatible with parameter of type "double *"
surfGF4_(w, sigm11x, sigm12x, sigm21x, sigm22x, sigmN_1N_1x, sigmN_1Nx, sigmNN_1x, sigmNNx);
^

GlobalRev.c(1315): error: operand of "*" must be a pointer
*sigm11_w[i][j] = *sigm11x[i][j];
^

GlobalRev.c(1315): error: expression must have pointer-to-object type
*sigm11_w[i][j] = *sigm11x[i][j];
^

GlobalRev.c(1316): error: expression must have pointer-to-object type
*noisevarleft11x[i][j] = - (pow(exp(hbar*w/(k_B*T_left))-1,-1) + 0.5)*hbar*h*len*(*sigm11x[i][j]);
^

GlobalRev.c(1316): error: identifier "T_left" is undefined
*noisevarleft11x[i][j] = - (pow(exp(hbar*w/(k_B*T_left))-1,-1) + 0.5)*hbar*h*len*(*sigm11x[i][j]);
^

GlobalRev.c(1316): error: expression must have pointer-to-object type
*noisevarleft11x[i][j] = - (pow(exp(hbar*w/(k_B*T_left))-1,-1) + 0.5)*hbar*h*len*(*sigm11x[i][j]);
^

GlobalRev.c(1318): error: expression must have pointer-to-object type
fprintf(out11x, "%lf", noisevarleft11[i][1]);
..............
.............etc

The most serious error is perhaps the one which says
"error: expression must have pointer-to-object type"
I have repeatedly re-checked my definition of pointer and its use in this program (also considering the use of libary function FFTW in defining complex variables) and also the use of those variables in calling function, but I still could not solve the problem. I think most likely the cause of error is in defining which one is pointer and which one is variable to which th pointer points, but I couldn't see which one is wrong. Could someone expert on C/C++ outthere help me on this please? Thanks in advance.

regards
Jul 29 '07 #1
1 23272
weaknessforcats
9,208 Expert Mod 8TB
GlobalRev.c(1313): error: argument of type "double" is incompatible with parameter of type "double *"
This error says you need a double* argument and you used a double.

It's on this call:
surfGF4_(w, sigm11x, sigm12x, sigm21x, sigm22x, sigmN_1N_1x, sigmN_1Nx, sigmNN_1x, sigmNNx);
It's the varible w which is defined as:
double w, dw;
You need to call with &w and not just w.

Try this. It should fix the first error. Subsequent errors may be due to this so you always fix the first error and rebuild.
Jul 29 '07 #2

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

Similar topics

2
by: Aloof | last post by:
Using Access 2000 Windows Server 2003 The following code worked fine until we moved hosting companies StartDate = Request.Form("StartDateMonth") & "/" & Request.Form ("StartDateDay") & "/" &...
1
by: ksrkp | last post by:
Iam getting a The expression on click you entered as the event property error when I tried run an MDE file at users desk top when executing a query which has qry1="select x from y where z not in...
1
by: Carlos Kim via DotNetMonster.com | last post by:
Compiler Error Message: CS1026: ) expected Source Error: Line 12: <body MS_POSITIONING="GridLayout"> Line 13: <form id="Form1" method="post" runat="server"> Line 14:...
2
by: isaac2004 | last post by:
hello i am getting a weird al syntax error from my SQL statement Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error (missing operator) in query expression...
4
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The...
3
by: clino | last post by:
const int c=9; void main() { int a=9; switch (a) { case c: a=c+1; break;
8
by: Anshul | last post by:
Hi, I tried compiling this code - int main() { char abc = "%s"; printf("\033[1m" abc "\033[m" , "doing"); }
1
by: Francesco Moi | last post by:
Hi. I get this error message on my Firefox Error Console: ---------------- Error: missing } in XML expression Source File: http://www.foo.com/js/maps.js Line: 273, Column: 18 Source Code:...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
2
werks
by: werks | last post by:
Hello PHP experts how can you detect ' character in your search field? Because every time I input the word hilgard's it returns an error I think because of the character '. This is the error ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.