473,699 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c oeff_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 6199
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**********@gm ail.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.c oeff_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_A rray[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**********@gm ail.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..n ot 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**********@gm ail.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**********@i nvalid.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.c om, 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_Keit h) 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**********@gm ail.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

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

Similar topics

2
17562
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 compiler as the page is requested by the browser. The result is that the "compiler failed with error code 2000". I have tested the same code on another workstation with VS.NET and it works fine EVERY time. I'm convinced it's not the code and I...
8
1894
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 much interest. But it's driving me nuts. Here's what happens. I'm working on a multi project VB app. happily writing nice inoffensive code - go to compile and the compiler tells me there's a problem in a project I'm not working on. But really...
30
2942
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 eventually, here is what happens. Anyone ever experience anything similar. This or similar untrackable problems happen to me whenever I write a large class... anyone have had similar experiences??? make
3
5263
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 (0xc0000005 at address 535F072A): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are...
4
3317
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 property 'DocItem' should be 'DocItems.' The problem is that instead of notifying me of where the problem has occurred, the compiler just crashes with an "internal error" (see bottom of this message). Now if I were to write: ...
6
2724
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 facing the same problem with many of them: I keep getting errors such as: ....\WinUser.h(8028): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701)
10
3273
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 article 320004 except that particular problem was
2
6768
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: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
1
3768
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 linux box using rsh it gives me the errors below Microsoft (R) Development Environment Version 7.10.3077. Copyright (C) Microsoft Corp 1984-2001. All rights reserved. ------ Build started: Project: SigComp, Configuration: Release Win32 ------...
27
3062
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 the source (gcc-4.3.1/gcc/c-common.c) of gcc 4.3.1, is a syntax error. I'm inclined to agree, as it is like no C I have ever met. what is "C_COMMON_FIXED_TYPES (, fract);" supposed to mean? Could it be
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.