結構與物件

來放一些除錯時找到的有用資料
原址:http://stackoverflow.com/questions/11808162/error-expected-unqualified-id-before-token-std-vector
 
 
 
節錄: 
typedef struct
{
    std :: string latitude;
    std :: string longitude;
} coordinate;
coordinate is typedef on anonymous struct, not object. You should create object of coordinate in your function, or not use typedef, i.e.
struct coord
{
    std :: string latitude;
    std :: string longitude;
} coordinate;
now, coordinate is object. And one question, why you type spaces after std and after ::? It's legal, but strange.

留言

Translate