By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

problem with compilation

P: n/a
Hi all,
I am new to C programming. I have problem compiling a sample ,

#include <stdio.h>

int getuniqueaddress1(){
return 1;
}
int getuniqueaddress2(){
return 2;
}

int getuniqueaddress3(){
return 3;
}

typedef struct IRpcStubBufferVtbl
{
int wuEpad10; int wuEpad20; int wuEpad30;

}IRpcStubBufferVtbl;
struct IRpcStubBuffer
{
struct IRpcStubBufferVtbl *lpVtbl;
};

typedef struct tagCInterfaceStubVtbl
{
IRpcStubBufferVtbl Vtbl;
} CInterfaceStubVtbl;

const CInterfaceStubVtbl _IClassFactoryStubVtbl =
{
getuniqueaddress1(),getuniqueaddress2(),getuniquea ddress3()

};

int main()
{

}
Any idea about why I am hitting compilation error? Any work around for
fixing this problem?

Thanks in advance,
Seema

Mar 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
seema wrote:
Hi all,
I am new to C programming. I have problem compiling a sample ,

#include <stdio.h>

int getuniqueaddress1(){
return 1;
}
int getuniqueaddress2(){
return 2;
}

int getuniqueaddress3(){
return 3;
}

typedef struct IRpcStubBufferVtbl
{
int wuEpad10; int wuEpad20; int wuEpad30;

}IRpcStubBufferVtbl;
struct IRpcStubBuffer
{
struct IRpcStubBufferVtbl *lpVtbl;
};

typedef struct tagCInterfaceStubVtbl
{
IRpcStubBufferVtbl Vtbl;
} CInterfaceStubVtbl;

const CInterfaceStubVtbl _IClassFactoryStubVtbl = Identifiers beginning with an underscore followed by a capital letter
are reserved to the implementation. {
getuniqueaddress1(),getuniqueaddress2(),getuniquea ddress3() Static (in this case file scope) variables must be initialized with
*constants* (if they're explicitly initialized) in C. Move the
declaration into main() and pass as needed.
};

int main()
{

}
Any idea about why I am hitting compilation error? Any work around for
fixing this problem?

See above.

Next time, however, be sure to include the compilation errors you get.

HTH,
--ag
--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com
"You can't KISS* unless you MISS**"
[*-Keep it simple, stupid. **-Make it simple, stupid.]
Mar 15 '06 #2

P: n/a

Here is the compilation error i get when I compile this program on
HP-UX,
"xsample2.c", line 31: error #2059: function call is not allowed in a
constant
expression
getuniqueaddress1(),getuniqueaddress2(),getuniquea ddress3()
^

"xsample2.c", line 31: error #2146: too many initializer values
getuniqueaddress1(),getuniqueaddress2(),getuniquea ddress3()
^

2 errors detected in the compilation of "xsample2.c"
Artie Gold wrote:
seema wrote:
Hi all,
I am new to C programming. I have problem compiling a sample ,

#include <stdio.h>

int getuniqueaddress1(){
return 1;
}
int getuniqueaddress2(){
return 2;
}

int getuniqueaddress3(){
return 3;
}

typedef struct IRpcStubBufferVtbl
{
int wuEpad10; int wuEpad20; int wuEpad30;

}IRpcStubBufferVtbl;
struct IRpcStubBuffer
{
struct IRpcStubBufferVtbl *lpVtbl;
};

typedef struct tagCInterfaceStubVtbl
{
IRpcStubBufferVtbl Vtbl;
} CInterfaceStubVtbl;

const CInterfaceStubVtbl _IClassFactoryStubVtbl =

Identifiers beginning with an underscore followed by a capital letter
are reserved to the implementation.
{
getuniqueaddress1(),getuniqueaddress2(),getuniquea ddress3()

Static (in this case file scope) variables must be initialized with
*constants* (if they're explicitly initialized) in C. Move the
declaration into main() and pass as needed.

};

int main()
{

}
Any idea about why I am hitting compilation error? Any work around for
fixing this problem?

See above.

Next time, however, be sure to include the compilation errors you get.

HTH,
--ag
--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com
"You can't KISS* unless you MISS**"
[*-Keep it simple, stupid. **-Make it simple, stupid.]


Mar 15 '06 #3

P: n/a
On Wednesday 15 March 2006 05:38, seema opined (in
<11*********************@p10g2000cwp.googlegroups. com>):
seema wrote:
> Hi all,
> I am new to C programming. I have problem compiling a sample ,
<snip problem code, and solution provided>
> Any idea about why I am hitting compilation error? Any work around
> for fixing this problem?
>

See above.

Next time, however, be sure to include the compilation errors you
get.

Here is the compilation error i get when I compile this program on


<snip error messages>

First, please don't top-post (I corrected it this time).

Second, there was no reason, or value, in posting compilation errors
after you were given explanation of the problem, especially as Artie
correctly guessed what your problem was, and gave advice how to fix it.

--
BR, Vladimir

CYNIC:
One who looks through rose-colored glasses with a jaundiced eye.

Mar 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.