Dec 31, 2012 at 4:46pm Dec 31, 2012 at 4:46pm UTC
My file reads in part like this:
-----------------------------------------------------------
/* Main.c for PC side of control fed to
* AVR by UART/ RS232
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
void *control_updater (unsigned char rs232_control[10][10]);
void main(int argc, char **argv)
{
control_init();
----------------------------------------------------
When compiled in AVI, CodeBlocks, the following error appears:
----------------------------------------------------
/home/Dev_Plat/Desktop/Control_Course/main.c --- line 20 --- error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token|
||=== Build finished: 1 errors, 0 warnings ===|
----------------------------------------------------
I have retyped the lines, and cannot find how to correct it.
Can anyone guide me?
Dec 31, 2012 at 4:59pm Dec 31, 2012 at 4:59pm UTC
Can you please point out line 20? Posting a complete compilable program would probably help.
Dec 31, 2012 at 7:28pm Dec 31, 2012 at 7:28pm UTC
The complete Main.c is posted here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/
/* Main.c for PC side of control fed to
* AVR by UART/ RS232
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "pthread.h"
void *control_updater (unsigned char rs232_control[10][10]);
int main(int argc, char **argv)
{ // <------ This is line 20
control_init();
pthread_t control_thread;
int iret, i, x;
iret = pthread_create(&control_thread, NULL, control_updater, rs232_control);
while (1)
{
printf("Control: sidewaves\n" ); // sidewaves
sidewaves(2000,100);
printf("Control: ripples\n" ); // ripples
ripples(2000,100);
printf("Control: spinwave\n" ); // spinwave
spin(2000,100);
printf("Control: sinewaves\n" ); // Sinelwave
sinelines(2000,100);
printf("Control spherical\n" ); // Spherical
spherical1500,100);
printf("Control: Explosive" ); // Explosive
fireworks(7,50,1200);
}
}
void *control_updater (unsigned char rs232_control[8][8])
{
unsigned char send_control[8][8];
while (1)
{
memcpy(send_control, rs232_control, 64);
control_push(send_control);
}
}
There are numerous other files.
The error message refers to the line 20 indicated
Last edited on Jan 1, 2013 at 3:20pm Jan 1, 2013 at 3:20pm UTC
Dec 31, 2012 at 7:41pm Dec 31, 2012 at 7:41pm UTC
Please post your complete error messages exactly as they appear in your development environment. Also in the code you posted line 9 has an error, it's missing the #.
Dec 31, 2012 at 7:52pm Dec 31, 2012 at 7:52pm UTC
The # is missing due to my copying error to the posting, and the complete error message is posted above
Last edited on Dec 31, 2012 at 7:52pm Dec 31, 2012 at 7:52pm UTC
Dec 31, 2012 at 9:50pm Dec 31, 2012 at 9:50pm UTC
The only other problem I see is that you probably should be using <> instead of "" for the pthread.h include.
Jan 1, 2013 at 3:19pm Jan 1, 2013 at 3:19pm UTC
I had put the pthread.h in my program directory in my attempts to figure out the problem... thus the "".