Hi.

In my previous post people said to me i need an array. I'm trying to insert things in an array and I get errors.

This is the full code.

This is my piece of code (from line 77 to 85):

int buttons_add_audio_input[howmanyofeach];
  int i = 0;
  while (i < howmanyofeach) {
    buttons_add_audio_input[i] = gtk_button_new_with_label("Add Audio Input"); /* creates the button */
    gtk_widget_set_size_request (buttons_add_audio_input[i], 150, 30); /* sets the size */
    gtk_fixed_put(GTK_FIXED(frame), buttons_add_audio_input[i], 0, 0); /* adds the button to the frame in a position */
    g_signal_connect(buttons_add_audio_input[i], "clicked", G_CALLBACK(jack_add_input), NULL); /* connects the button to a function */
    i ++;
  }

And this are the errors I get:

vass.c:80: warning: assignment makes integer from pointer without a cast
vass.c:81: warning: passing argument 1 of ‘gtk_widget_set_size_request’ makes pointer from integer without a cast
vass.c:82: warning: passing argument 2 of ‘gtk_fixed_put’ makes pointer from integer without a cast
vass.c:83: warning: passing argument 1 of ‘g_signal_connect_data’ makes pointer from integer without a cast

I presume your functions arte wanting a pointer argument

try prefixing your array argument with &

I don't know what the function gtk_button_new_with_label() does since it is not prototyped in the code you provide, however, it appears that returns a pointer and not an int.
Making all the errors part of the same problem.

vass.c:80: warning: assignment makes integer from pointer without a cast

That's the first error warning and it is saying: Hey, I am returning a pointer and you are trying to push it into an int called buttons_add_audio_input[i]

vass.c:81: warning: passing argument 1 of ‘gtk_widget_set_size_request’ makes pointer from integer without a cast

Second error warning: Hello, I am gtk_widget_set_size_request() function and I don't take an integer as my first argument. Guess what's the first argument? Yeap, buttoms_add_audio_input[i] integer that it was
wrong before.

vass.c:82: warning: passing argument 2 of ‘gtk_fixed_put’ makes pointer from integer without a cast
vass.c:83: warning: passing argument 1 of ‘g_signal_connect_data’ makes pointer from integer without a cast

Well, to end this parade of complainers, let's look at these two together.
Since you keep bouncing around that int buttons_add_audio_input[i] gtk_fixed_put and g_signal_connect_data functions don't want to feel like children of a lesser god and of course they complained when you tried to shovel that int in their throats, since they only like pointers and are prejudiced against ints.

Does it help?

Hi and thanks.

I understand Aia, and i don't understand MR_Developer at all.

Aya, I understand you, but i don't know how to make my code work.

MR_Developer, I tried to do what i understood, i put a & before the name of my array, I did this:

int buttons_add_audio_input[howmanyofeach];
  int i = 0;
  while (i < howmanyofeach) {
    &buttons_add_audio_input[i] = gtk_button_new_with_label("Add Audio Input"); /* creates the button */
    gtk_widget_set_size_request (&buttons_add_audio_input[i], 150, 30); /* sets the size */
    gtk_fixed_put(GTK_FIXED(frame), &buttons_add_audio_input[i], 0, 0); /* adds the button to the frame in a position */
    g_signal_connect(&buttons_add_audio_input[i], "clicked", G_CALLBACK(jack_add_input), NULL); /* connects the button to a function */
    i ++;
  }

Now this are the errors:

vass.c: In function ‘make_mainwindow’:
vass.c:80: error: lvalue required as left operand of assignment
vass.c:81: warning: passing argument 1 of ‘gtk_widget_set_size_request’ from incompatible pointer type
vass.c:82: warning: passing argument 2 of ‘gtk_fixed_put’ from incompatible pointer type

And here is the full code.

your problems are so widespread and fundamental, it's not reasonable for me to even try and debug it. this is not a simple fix. to be blunt, you are attempting to take on too complex of a project (for your skill level) at one time.

theres no way to help you at this point, short of rewriting your code and handing it back to you, which would be a lot of effort for us, and no learning opportunity for you.

redefine the scope of your project, and break it into little pieces. do one thing at one time. get that one thing to work right. then as you understand what you are doing, you can expand from there to incorporate more.

you cant just jump into a project with 100 moving parts, and have no clue how many are broken at any given time. narrow your focus down to working on one piece at at time. this forum will help you as you have specific questions.

Hi again, and thanks.

I'll try to learn more of C, and I'll try to ask less.

I'm not saying to not ask questions.... but to ask the right way to get the answers that will be meaningful.

i understand where you are coming from because I've been there myself.

the problem is you're trying to implement the whole shebang all at once and you're paralysed by a non working implementation that you don't know where to begin to debug.

start small, instead. implement one single function and get it to work. then another. then think about how to construct the framework or shell, and how to insert the functionality into that.

(one problem i'm having is I can't access your source code, so i can't relook at your code. i could see it last night at home, but now your webserver is either taking too long to respond, or i've got firewall issues at my work.)

I'm not saying to not ask questions.... but to ask the right way to get the answers that will be meaningful.

i understand where you are coming from because I've been there myself.

the problem is you're trying to implement the whole shebang all at once and you're paralysed by a non working implementation that you don't know where to begin to debug.

start small, instead. implement one single function and get it to work. then another. then think about how to construct the framework or shell, and how to insert the functionality into that.

(one problem i'm having is I can't access your source code, so i can't relook at your code. i could see it last night at home, but now your webserver is either taking too long to respond, or i've got firewall issues at my work.)

Oh, sorry, I'm changing my Internet Service Provider and today i made tests with my new service, so maybe my IP have changed, or the DNS have not updated to my new IP, try with this:
http://79.145.36.142/wasge/labs/files.php?action=file&file=files/vass/devel/vass.c&format=yes
Since this have no DNS and i'm changing my ISP this location will be unreachable in hours or days.
http://wasge.es/wasge/labs/files.php?action=file&file=files/vass/devel/vass.c&format=yes
This should work too, and should work every time in the future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.