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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 5, 2008 5:39 PM, Jim Stapleton <stapleton.41@xxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux