473,320 Members | 2,111 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,320 software developers and data experts.

Compiler Error - help

Hi,
so basically I define a struct as follows:
struct speechSegment {

float coeff_Array[10];
float period;
float energy;
};

struct speechSegment segment = { /*I fill this struct with info */};

and later on in my main(), I declare a static array called coef[10],
and basically try to assign each value of coef[10] to the corresponding
value of coeff_Array

for(i = 0; i < Cmpst; i++) {
coef[i] = (int)(segment.coeff_Array[i]); -----------> Getting
compiler error on this line
}

But when I try to compile I get a compiler error on the aforementioned
line.
The error says "error: expression must have pointer-to-object type"

Any help as to why I'm getting this error will be appreciated..
Thanks,
Ravi

Nov 16 '05 #1
11 6178
Also please note that coef is an array of ints, so thats why I
casted....just to let you guys know...but I don't think thats why the
error is being generated
Thanks,
Ravi

Nov 16 '05 #2
ra**********@gmail.com wrote:
Hi,
so basically I define a struct as follows:
struct speechSegment {

float coeff_Array[10];
float period;
float energy;
};

struct speechSegment segment = { /*I fill this struct with info */};

and later on in my main(), I declare a static array called coef[10],
and basically try to assign each value of coef[10] to the corresponding
value of coeff_Array

for(i = 0; i < Cmpst; i++) {
coef[i] = (int)(segment.coeff_Array[i]); -----------> Getting
compiler error on this line
}

But when I try to compile I get a compiler error on the aforementioned
line.
The error says "error: expression must have pointer-to-object type"

Any help as to why I'm getting this error will be appreciated..
Thanks,


Please provide a minimal example -- your description is essentially
useless:
The following

int main (void)
{
struct speechSegment {
float coeff_Array[10];
float period;
float energy;
} segment = { {-0.1F, 1.0E4F, 47.11F, 0.F, 0.F,
0.F, 0.F, 0.F, 0.F, 0.F},
3.141592654F, 0.0F};
int i;
static int coef[10];
for(i = 0; i < 10; i++) {
coef[i] = segment.coeff_Array[i];
}

return 0;
}

compiles _and_ fits your description.

You probably declared coef in the wrong way.
Note that casting can mask errors; therefore, use as few casts
as possible. Here, casting is unnecessary and can be left out.

If you answer, please quote enough context -- not everyone
gets every message in the same order or at all.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 16 '05 #3
Sorry - OK I guess I don't get this - why did you declare coef as
static?
Ravi

Nov 16 '05 #4
I asked you explicitly to quote context. Why are you making
it harder for people to help you?
If you are using google and don't know how, search via
groups.google for Keith Thompson's signature on this topic.

ra**********@gmail.com wrote:
Sorry - OK I guess I don't get this - why did you declare coef as
static?


You stated:
"and later on in my main(), I declare a static array called coef[10],"
So, I gave you a "static array 10 of int" called coef.
If you meant something different by "static array" within the
context of C, then say so.

-Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 16 '05 #5
Oh wow...ok see I was trying to understand what you meant by quoting
context...MY Mistake! - I had never declared a static array...I had
meant to say I declared allocated memory off the stack for
this...stack..not static..sorry...regardless it doesnt matter..I did'nt
mean to say that.

Hmm..regardless, even declaring coef as a static array doesnt solve the
compiler problem

Ravi

Nov 16 '05 #6
I apologize for being confusing...but clarify on what you mean by
quoting context....I don't post here often so this will be good to know
Ravi

Nov 16 '05 #7
ra**********@gmail.com wrote:
I apologize for being confusing...but clarify on what you mean by
quoting context....I don't post here often so this will be good to know
Ravi

`Quoting context' means just that. In *your message* quote the relevant
part of the the message to which you are replying. Otherwise those of us
who use real newsreaders have no idea what you're talking about.

[Note: I have quoted your message above...see?]

HTH,
--ag

--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
Nov 16 '05 #8
Michael Mair <Mi**********@invalid.invalid> writes:
I asked you explicitly to quote context. Why are you making
it harder for people to help you?
If you are using google and don't know how, search via
groups.google for Keith Thompson's signature on this topic.


It's not actually my signature; it's something I wrote that others
have used as their signatures.

Here it is:

If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 16 '05 #9
ra**********@gmail.com wrote:
Sorry - OK I guess I don't get this - why did you declare coef as
static?
Ravi


Ravi, please re-read Michael's response carefully. I'll highlight the
relevant portions:

"If you answer, please quote enough context." Please provide enough
context so that any particular message can be read by itself. Some
readers may have never seen your original post, nor Michael's response.
Some readers may have read those posts, but can no longer remember them
by the time they read your post. Please provide context in each and
every reply. Some newsreaders make this difficult, but not impossible.
If you are using Google Groups, for example, you have to perform special
magic to make this happen. The steps are described dozens of times per
day in this newsgroup alone.

"Please provide a minimal example." No one can debug your problem from
the incomplete data given in your original post, Michael's admirable
effort notwithstanding. please provide the smallest program you can that
still demonstrates your problem. Rather than make us guess which of the
ten million possible mistakes you might have made, we can tell you
precisely which one you did.

"The following ... fits your description." Your exchange so far reads
like this:
You: "I declare a static array called coef[10]".
Michael: "static int coef[10];".
You: "why did you declare coef as static?"
This precisely highlights why Michael wants to study your program,
instead of you studying his. We can't guess what is wrong with your
program from you inexact explanation. Only by pasting the exact program
that fails can we understand your problem.

I hope this helps. I look forward to seeing your response, with context,
and with a small program that demonstrates the error.

Rob
Nov 16 '05 #10
ra**********@gmail.com wrote:
I apologize for being confusing...but clarify on what you mean by
quoting context....I don't post here often so this will be good to
know Ravi


Read my .sig below.

Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Nov 17 '05 #11
Hi,
Well the problem is solved...but a lesson was learned too..

Thanks,
Rob Adams wrote:
ra**********@gmail.com wrote:
Sorry - OK I guess I don't get this - why did you declare coef as
static?
Ravi


Ravi, please re-read Michael's response carefully. I'll highlight the
relevant portions:

"If you answer, please quote enough context." Please provide enough
context so that any particular message can be read by itself. Some
readers may have never seen your original post, nor Michael's response.
Some readers may have read those posts, but can no longer remember them
by the time they read your post. Please provide context in each and
every reply. Some newsreaders make this difficult, but not impossible.
If you are using Google Groups, for example, you have to perform special
magic to make this happen. The steps are described dozens of times per
day in this newsgroup alone.

"Please provide a minimal example." No one can debug your problem from
the incomplete data given in your original post, Michael's admirable
effort notwithstanding. please provide the smallest program you can that
still demonstrates your problem. Rather than make us guess which of the
ten million possible mistakes you might have made, we can tell you
precisely which one you did.

"The following ... fits your description." Your exchange so far reads
like this:
You: "I declare a static array called coef[10]".
Michael: "static int coef[10];".
You: "why did you declare coef as static?"
This precisely highlights why Michael wants to study your program,
instead of you studying his. We can't guess what is wrong with your
program from you inexact explanation. Only by pasting the exact program
that fails can we understand your problem.

I hope this helps. I look forward to seeing your response, with context,
and with a small program that demonstrates the error.

Rob


Nov 18 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike Fisher | last post by:
I'm seeing an error when I try to run/debug a web service. Although it doesn't happen every time, it does occur more than half of the times I hit F5. It appears to be returned by the the JIT...
8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
30
by: Neil Zanella | last post by:
Hello, Allow me to share my frustrations with GNU g++. This is the second time something similar happens to me: I can't find anything wrong with my C++ program and yet I get segfaults, and...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
4
by: David Sworder | last post by:
Consider the following line of code (it's not important what it does): resp.DocItem=Relations.SelectDocItems_BySearchString(req.SearchPhrase); It turns out that this line is in error. The...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
10
by: PufferFish | last post by:
Hi folks, I hope that this is the correct group for these things, apologies if not. I've got a strange compiler error. It appears to be similar to the issue described in knowledgebase...
2
by: Roger Wang | last post by:
HELP!!!! We have got a W2k server running IIS5 with .NET framework 1.1 and .NET framework SP1. All ASP.NET applications cannot run on this box. It all returned with the same error: ...
1
by: kvarada | last post by:
Hello Experts, I am building my application on WinNT.4.0_i386_MSVC.7.1 platform. When I build the application on a stand alone machine, it builds fine. But when I build the same application from a...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.