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

problem with compilation

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
3 3359
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alex Vinokur | last post by:
Hi, The code below has no problem with GNU g++ 3.3, but it has a problem with GNU g++ 3.4. What is reason for that? --------- foo.cpp : BEGIN --------- template <typename T> struct Boo
9
by: ludocluba | last post by:
Hello, here is my problem: I have 3 files: main.c toto.c toto.h: ----------------------------------------------------------- toto.h: #ifndef _toto_h #define _toto_h int var; void test(void);...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
10
by: greenb | last post by:
Our asp.net web app uses a .NET component (DLL) in the bin directory to call several stored procedures back to back to perform updates. They don't return any data. Sometimes the total execution...
6
by: BookerW | last post by:
Ok interesting, on my local machine And i did not do a good job of keeping track of the exact order.... but on my local machine in which i have vis studio 2003 installed and IIS for win XP,...
0
by: Rasika WIJAYARATNE | last post by:
Hello everyone, We have a forum system on our website. The main web application is running in a virutal directory called /t7 and the forum system is on / t7/forums/. When someone wants to post...
12
by: jcor | last post by:
Hi, I'm using Ubuntu 7.04. I'm writing a sript that sends files via ftp for several destinations. So far I used Net::FTP and it worked fine. My problem is that I need to send files via SFTP...
1
by: Alex Vinokur | last post by:
Hi, I have compilation problem on SUN CC compiler with template while using option -m64 (64-bit addressing model). No problem while using option -m32 (32-bit addressing model) $ CC -V CC:...
2
by: somsub | last post by:
Hi all, Here is my samle code use strict ; use warnings ; use IO::Uncompress::Unzip ; When I compiled this three lines of code in win32 I got error like below.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.