This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "expected primary-expression before..." errors


Thanks, I've been doing too much python lately.
That, and I found I also had to declare one dimension of the array,
otherwise I got another error:

char *vpd[4]=  // an array of char*
{
// string 1
"CREATE TABLE vpd (\n"
"dir    TEXT NOT NULL,\n"
"  actual TEXT NOT NULL,\n"
"  PRIMARY KEY(id)"
");\n"
"CREATE INDEX vpd_ind ON vpd(dir);", //primary search, dir
//string 2
"SELECT sql FROM sqlite_master WHERE name='vpd';",
"dir\0actual",
"DROP TABLE vpd;"
};


But it works now,
Thanks,
-Jim Stapleton


On Feb 5, 2008 7:08 PM, Tom Browder <tom.browder@gmail.com> wrote:
> On Feb 5, 2008 5:39 PM, Jim Stapleton <stapleton.41@gmail.com> wrote:
> > Roughly stated, what do these mean? The first three errors in some
> > code I have are as follows:
> >
> >     vp_sqlite2_init.cpp:16: error: expected primary-expression before '[' token
> ...
> > The lines of code are here (the lines starting with ">" reference the
> > erroneous lines):
> ...
> > //virtual ports directory structure
> > char *vpd[]=
> > >["CREATE TABLE vpd (\n"
> >  "  dir    TEXT NOT NULL,\n"
> >  "  actual TEXT NOT NULL,\n"
> >  "  PRIMARY KEY(id)"
> >  ");\n"
> >  "CREATE INDEX vpd_ind ON vpd(dir);", //primary search, dir
> >  "SELECT sql FROM sqlite_master WHERE name='vpd';",
> >  "dir\0actual",
> >  "DROP TABLE vpd;"]; //dir will contain the whole directory - I don't
>
> I'm not sure what you're trying to do, but try replacing the square
> brackets in the initializers with curly braces (i.e., '[' => '{', ']'
> => '}').
>
> For example:
>
> char *vpd[]=  // an array of char*
> {
> // string 1
> "CREATE TABLE vpd (\n"
> "dir    TEXT NOT NULL,\n"
> "  actual TEXT NOT NULL,\n"
> "  PRIMARY KEY(id)"
> ");\n"
> "CREATE INDEX vpd_ind ON vpd(dir);", //primary search, dir
> //string 2
> "SELECT sql FROM sqlite_master WHERE name='vpd';",
> "dir\0actual",
> "DROP TABLE vpd;"
> }; //dir will contain the whole directory - I don't
>
> HTH.
>
> -Tom
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]