* parse error at end of input :( [not found] <5b8d9a10609130947t686f413cn77f6605528604b76@mail.gmail.com> @ 2006-09-13 17:08 ` Jordi Vendrell 2006-09-13 17:28 ` John Love-Jensen 0 siblings, 1 reply; 7+ messages in thread From: Jordi Vendrell @ 2006-09-13 17:08 UTC (permalink / raw) To: gcc-help [-- Attachment #1: Type: text/plain, Size: 389 bytes --] hi, I'm compiling a program I have here using gcc-2.95 but I get this main.c:219: parse error at end of input error message. I've checked but haven't seen any parse error. Anyone sees where is the problem? I'm using Knoppix distro with kernel 2.4.27 kind regards Jordi Vendrell PS: the program is a function separated from a bigger program, but I guess it should work anyway [-- Attachment #2: main.c --] [-- Type: text/x-csrc, Size: 4946 bytes --] #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <comedilib.h> #include <comedi.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <getopt.h> #include <ctype.h> #include <asm/io.h> #include <unistd.h> #include <pthread.h> #include <linux/kernel.h> #include "examples.h" #define PORT 0x280 //digital I/O port PC embedded //varaibles globals per controlar l'hora i el dia struct tm *hora; time_t time1; int dia; //struct on es gauardaran les dades un cop aquestes siguin definitives FILE *df; struct dades_t{ float vsolar; //tensio plaques solars float vbp; //tensio bateria petita float vbg; //tensio bateria gran float vzener; //tensio zener float isbp; //intensitat p.solar bat petita float isbg; //intensitat p.solar bat gran float icbp; //intensitat carrega bat petita float idbg; //intensitat carrega dissipadora bat gran float inbg; //intensita carrega nominal bat gran float ieolos; //intensitat aerogenrador float dirvent; //direccio del vent float vent; //velocitat del vent }; struct dades_t mesures; //struct per tenir el balans de potencia struct balans_t{ float Qinbp; float Qoubp; float incQp1p; float Qinbg; float Qoubg; float incQp1g; }; struct balans_t balcarr; pthread_mutex_t mutex; comedi_t *device; //descriptor de fitxer del comedi int subdevice; //amb el qual selecionem quin tipus de senyal estem treballant analoques, digitals, counters,etc int rang; //representa els augments i aspectes de les i/o analogiques de unipolar/bipolar int aref=AREF_GROUND; //com es realitzara la mesura float perdues=0; int mosfet1=0, mosfet2=0, mosfet3=0, mosfet4=0, mosfet5=0; int apagar=1; int actiu=0; #define M_PACK2(a,b) (((a)<<2) | (b)) #define M_PACK4(a,b,c,d) ((M_PACK2(a,b)<<4 | M_PACK2(c,d)) #define M_IGN 0 #define M_INC 1 #define M_DEC 2 struct counter_config_struct{ unsigned int id; unsigned int inp0_src; unsigned int inp0_arg; unsigned int inp0_mach; unsigned int inp1_src; unsigned int inp1_arg; unsigned int inp1_mach; }; void main (void) { double mostres1[4]; lsampl_t dades; comedi_range *cmrg; int maxdata; device=comedi_open("/dev/comedi0"); if(device == NULL) { comedi_perror(filename); exit(0); } while(apagar==1) { // pthread_mutex_lock(&mutex); subdevice=0; maxdata=comedi_get_maxdata(device,subdevice,7); cmrg=comedi_get_range(device,subdevice,7,rang); if(actiu==0) { if(ioperm(PORT,1,1)) { perror("ioperm"); exit(1); } outb(0x00,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[0]=comedi_to_phys(dades,cmrg,maxdata); outb(0x01,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[1]=comedi_to_phys(dades,cmrg,maxdata); outb(0x02,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[2]=comedi_to_phys(dades,cmrg,maxdata); outb(0x03,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[3]=comedi_to_phys(dades,cmrg,maxdata); } if(actiu==1) { if(ioperm(PORT,1,1)) { perror("ioperm"); exit(1); } outb(0x04,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[0]=comedi_to_phys(dades,cmrg,maxdata); outb(0x05,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[1]=comedi_to_phys(dades,cmrg,maxdata); outb(0x06,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[2]=comedi_to_phys(dades,cmrg,maxdata); outb(0x07,PORT); usleep(10000); comedi_data_read(device,subdevice,7,rang,aref,&dades); mostres1[3]=comedi_to_phys(dades,cmrg,maxdata); } if(ioperm(PORT,1,0)) //tanquem el canal per escriure sobre le PORT del PC embedded { perror("ioperm"); exit(1); } mesures.vzener=mostres1[2]; //guardem les dades a l'struct assignada perdues=8.02-mesures.vzener; //modificant el possible error que hi pugui haver mesures.vbg=(mostres1[0]+perdues)/0.56; printf("el valor es :%f\n", mesures.vbg); mesures.vsolar=(mostres1[1]+perdues)/0.47; printf("el valor es :%f\n", mesures.vsolar); mesures.dirvent=(mostres1[3]+perdues)/0.68; printf("el valor es :%f\n", mesures.dirvent); // pthread_mutex_unlock(&mutex); } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-13 17:08 ` parse error at end of input :( Jordi Vendrell @ 2006-09-13 17:28 ` John Love-Jensen 2006-09-14 1:41 ` Jeffrey Holle 0 siblings, 1 reply; 7+ messages in thread From: John Love-Jensen @ 2006-09-13 17:28 UTC (permalink / raw) To: Jordi Vendrell, MSX to GCC Hi Jordi, I see that the body of main has an open-curly brace, but does not have a close-curly brace. That will cause a parse error at end of input. HTH, --Eljay ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-13 17:28 ` John Love-Jensen @ 2006-09-14 1:41 ` Jeffrey Holle 2006-09-14 16:27 ` Jordi Vendrell 0 siblings, 1 reply; 7+ messages in thread From: Jeffrey Holle @ 2006-09-14 1:41 UTC (permalink / raw) To: gcc-help I see that the M_PACK4 macro has an open "(". John Love-Jensen wrote: > Hi Jordi, > > I see that the body of main has an open-curly brace, but does not have a > close-curly brace. > > That will cause a parse error at end of input. > > HTH, > --Eljay > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-14 1:41 ` Jeffrey Holle @ 2006-09-14 16:27 ` Jordi Vendrell 2006-09-14 16:33 ` Glen Beane 0 siblings, 1 reply; 7+ messages in thread From: Jordi Vendrell @ 2006-09-14 16:27 UTC (permalink / raw) To: gcc-help Thanks to all, closing a brace fixed the problem. Now the thing follows with some messages saying /tmp/ccsz9G07.o(.text+0x124): In function `main': : undefined reference to `comedi_data_read' which I guess means a problem with the libraries (comedi.h and comedilib.h) I think it's a problem with the comedi version, so I'll compile again and see if it works now cheers Jordi Vendrell 2006/9/14, Jeffrey Holle <jeffreyholle@bellsouth.net>: > I see that the M_PACK4 macro has an open "(". > > John Love-Jensen wrote: > > Hi Jordi, > > > > I see that the body of main has an open-curly brace, but does not have a > > close-curly brace. > > > > That will cause a parse error at end of input. > > > > HTH, > > --Eljay > > > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-14 16:27 ` Jordi Vendrell @ 2006-09-14 16:33 ` Glen Beane 2006-09-14 17:31 ` Jordi Vendrell 0 siblings, 1 reply; 7+ messages in thread From: Glen Beane @ 2006-09-14 16:33 UTC (permalink / raw) To: Jordi Vendrell; +Cc: gcc-help thats a linking problem. It isn't finding the object file that contains the comedi_dara_read function. If that function is in a library, you probably just need to modify the -L flag so the linker can find it. Jordi Vendrell wrote: > Thanks to all, closing a brace fixed the problem. > Now the thing follows with some messages saying > > /tmp/ccsz9G07.o(.text+0x124): In function `main': > : undefined reference to `comedi_data_read' > > which I guess means a problem with the libraries (comedi.h and > comedilib.h) I think it's a problem with the comedi version, so I'll > compile again and see if it works now > > cheers > > Jordi Vendrell > > > > > 2006/9/14, Jeffrey Holle <jeffreyholle@bellsouth.net>: >> I see that the M_PACK4 macro has an open "(". >> >> John Love-Jensen wrote: >> > Hi Jordi, >> > >> > I see that the body of main has an open-curly brace, but does not >> have a >> > close-curly brace. >> > >> > That will cause a parse error at end of input. >> > >> > HTH, >> > --Eljay >> > >> > >> >> -- Glen L. Beane Software Engineer II The Jackson Laboratory Phone (207) 288-6153 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-14 16:33 ` Glen Beane @ 2006-09-14 17:31 ` Jordi Vendrell 2006-09-14 17:43 ` Glen Beane 0 siblings, 1 reply; 7+ messages in thread From: Jordi Vendrell @ 2006-09-14 17:31 UTC (permalink / raw) To: gcc-help Thanks for the quick answer. Actually I know nearly nothing about how the linker works. Could you tell me where to start? (or else how to modify the -L flag?) kind regards Jordi Vendrell 2006/9/14, Glen Beane <glen.beane@jax.org>: > thats a linking problem. It isn't finding the object file that contains the comedi_dara_read function. If that function is in a library, you probably just need to modify the -L flag so the linker can find it. > > > > Jordi Vendrell wrote: > > Thanks to all, closing a brace fixed the problem. > > Now the thing follows with some messages saying > > > > /tmp/ccsz9G07.o(.text+0x124): In function `main': > > : undefined reference to `comedi_data_read' > > > > which I guess means a problem with the libraries (comedi.h and > > comedilib.h) I think it's a problem with the comedi version, so I'll > > compile again and see if it works now > > > > cheers > > > > Jordi Vendrell > > > > > > > > > > 2006/9/14, Jeffrey Holle <jeffreyholle@bellsouth.net>: > >> I see that the M_PACK4 macro has an open "(". > >> > >> John Love-Jensen wrote: > >> > Hi Jordi, > >> > > >> > I see that the body of main has an open-curly brace, but does not > >> have a > >> > close-curly brace. > >> > > >> > That will cause a parse error at end of input. > >> > > >> > HTH, > >> > --Eljay > >> > > >> > > >> > >> > > -- > Glen L. Beane > Software Engineer II > The Jackson Laboratory > Phone (207) 288-6153 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: parse error at end of input :( 2006-09-14 17:31 ` Jordi Vendrell @ 2006-09-14 17:43 ` Glen Beane 0 siblings, 0 replies; 7+ messages in thread From: Glen Beane @ 2006-09-14 17:43 UTC (permalink / raw) To: Jordi Vendrell; +Cc: gcc-help man ld to learn about the linker. in your case you should have a libcomedi.a (for a static library) or a libcomedi.so (for a shared library). First, you need to tell the linker to link in one of these files by passing it -lcomedi (since you are most likely not invoking the linker directly, you can just pass this argument to gcc ). Then if you get an error message stating that it cant find libcomedi, you'll need to pass a -L flag to let the linker know in what directory it can find libcomedi.a or libcomedi.so Jordi Vendrell wrote: > Thanks for the quick answer. > Actually I know nearly nothing about how the linker works. Could you > tell me where to start? (or else how to modify the -L flag?) > > kind regards > > > Jordi Vendrell > > > > 2006/9/14, Glen Beane <glen.beane@jax.org>: >> thats a linking problem. It isn't finding the object file that >> contains the comedi_dara_read function. If that function is in a >> library, you probably just need to modify the -L flag so the linker >> can find it. >> >> >> >> Jordi Vendrell wrote: >> > Thanks to all, closing a brace fixed the problem. >> > Now the thing follows with some messages saying >> > >> > /tmp/ccsz9G07.o(.text+0x124): In function `main': >> > : undefined reference to `comedi_data_read' >> > >> > which I guess means a problem with the libraries (comedi.h and >> > comedilib.h) I think it's a problem with the comedi version, so I'll >> > compile again and see if it works now >> > >> > cheers >> > >> > Jordi Vendrell >> > >> > >> > >> > >> > 2006/9/14, Jeffrey Holle <jeffreyholle@bellsouth.net>: >> >> I see that the M_PACK4 macro has an open "(". >> >> >> >> John Love-Jensen wrote: >> >> > Hi Jordi, >> >> > >> >> > I see that the body of main has an open-curly brace, but does not >> >> have a >> >> > close-curly brace. >> >> > >> >> > That will cause a parse error at end of input. >> >> > >> >> > HTH, >> >> > --Eljay >> >> > >> >> > >> >> >> >> >> >> -- >> Glen L. Beane >> Software Engineer II >> The Jackson Laboratory >> Phone (207) 288-6153 >> -- Glen L. Beane Software Engineer II The Jackson Laboratory Phone (207) 288-6153 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-09-14 17:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <5b8d9a10609130947t686f413cn77f6605528604b76@mail.gmail.com> 2006-09-13 17:08 ` parse error at end of input :( Jordi Vendrell 2006-09-13 17:28 ` John Love-Jensen 2006-09-14 1:41 ` Jeffrey Holle 2006-09-14 16:27 ` Jordi Vendrell 2006-09-14 16:33 ` Glen Beane 2006-09-14 17:31 ` Jordi Vendrell 2006-09-14 17:43 ` Glen Beane
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).