"expected primary-expression before..." errors
Tom Browder
tom.browder@gmail.com
Wed Feb 6 00:09:00 GMT 2008
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
More information about the Gcc-help
mailing list