Hi, I'm trying to debug an app someone else wrote called eMixer. Here's
the log contents:
cc -O3 -funroll-loops -c -o main.o main.c
cc -O3 -funroll-loops -c -o nctgui.o nctgui.c
cc -O3 -funroll-loops -c -o mixer.o mixer.c
mixer.c: In function `open_soundcard_alsa':
mixer.c:201: warning: passing arg 3 of
`snd_pcm_hw_params_set_rate_near' makes pointer from integer without a
cast
cc -O3 -funroll-loops -c -o getlopt.o getlopt.c
cc -O3 -funroll-loops -c -o plstfunc.o plstfunc.c
cc -O3 -funroll-loops -c -o playfunc.o playfunc.c
playfunc.c: In function `do_autofade':
playfunc.c:524: error: initializer element is not constant
playfunc.c:524: error: (near initialization for `checkmode[0][0]')
playfunc.c:524: error: initializer element is not constant
playfunc.c:524: error: (near initialization for `checkmode[0][1]')
playfunc.c:524: error: initializer element is not constant
playfunc.c:524: error: (near initialization for `checkmode[0]')
And the line in question looks like this:
static int checkmode[3][2]={(0,0,0),(0,0,0)};
To try and solve this problem, I've commented out the static part and
while the program compiles, it segfaults when you try and run it. I've
also tried adding -ansi to the CFLAGS but that doesn't work. When I
searched the web, I got lots of hits about other people having the same
problem, but the code wasen't close enough that I could get an idea of
how thhe problem was fixed. does anyone have any ideas about what I
need to do here? Thank you for your time. 3 2404
Levi Campbell said: And the line in question looks like this:
static int checkmode[3][2]={(0,0,0),(0,0,0)};
That should be:
static int checkmode[3][2] = {{0, 0}, {0, 0}, {0, 0}};
or simply:
static int checkmode[3][2] = {0};
or even (because it's static):
static int checkmode[3][2];
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Holy crap, it worked and it didn't segfault! Thank you.
Richard Heathfield wrote: Levi Campbell said:
And the line in question looks like this:
static int checkmode[3][2]={(0,0,0),(0,0,0)};
That should be:
static int checkmode[3][2] = {{0, 0}, {0, 0}, {0, 0}};
or simply:
static int checkmode[3][2] = {0};
or even (because it's static):
static int checkmode[3][2];
-- Richard Heathfield "Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk email: rjh at above domain (but drop the www, obviously)
Levi Campbell wrote:
<snip> cc -O3 -funroll-loops -c -o mixer.o mixer.c
mixer.c: In function `open_soundcard_alsa':
mixer.c:201: warning: passing arg 3 of `snd_pcm_hw_params_set_rate_near' makes pointer from integer without a cast
Something Richard did not mention is that this is a potentially very
serious warning and you really should track it down and fix the issue.
However, do *not* fix it by simply adding a cast, that would almost
certainly be the *wrong* thing to do.
<snip>
also tried adding -ansi to the CFLAGS but that doesn't work. When I
<OT>
That is a good switch to use. You might also want to add the following
-pedantic -Wall -O
These switches have the potential to catch a lot more problems in the code.
</OT>
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Todd Nathan |
last post by:
Hi. have this code and compiler problem. GCC 2.95.3, BeOS, error
"initializer element is not constant"
#ifdef FILEIO
{ static struct {
char *sfn;
FILE *sfd;
} stdfiles = {
|
by: devdatta_clc |
last post by:
Hi C experts
I've a bunch of questions.
Consider this simplified piece of code.
const int a = 10;
int main () {
static int b = a;
|
by: emin.martinian |
last post by:
When trying to compile python extensions written in C using "python
setup.py build" on cygwin I get the following error:
foo.c: initializer element is not constant
foo.c: error: (near...
|
by: fred |
last post by:
Hi,
Can someone explain me why gcc-4.0 gives me the 'Initializer element is
not constant' error with this code ? Everything seems to be constant
here...
#include <stdio.h>
typedef struct {...
|
by: Paul Edwards |
last post by:
On ecgs (gcc) 2.91.57 and on gcc 3.2.3 I am getting the
error "initializer element is not constant" on the below
code. The code compiles fine with other compilers I
have. Is this valid C89 code?...
|
by: varuns |
last post by:
hi
i m stuck while compiling my code for generating bindings for c code to be accessible from python
i have read the ext.pdf available at python.org, and i think i have done every thing right.
...
|
by: varuns |
last post by:
hi
i m stuck while compiling my code for generating bindings for c code to be accessible from python
i have read the ext.pdf available at python.org, and i think i have done every thing right.
...
|
by: hankypan1 |
last post by:
Hi All,
I need a tree data structure for my application. It is the non -
cyclic
simple tree where i can have any number of children node and each
child can recursively become a sub tree like a...
|
by: Gowtham |
last post by:
Hi,
I had some C code written which initialized a global variable as:
FILE *yyerfp = stdout;
This used to work fine in older versions of gcc. Now, when I tried to
compile this code (with...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |