c++ - error: 'l' is not a type -


i'm programming in linux , have 1 problem. have initialize 2 vectors size 'l'. 'l' should given form command line.

this code:

    #include <iostream>     #include <sys/shm.h>     #include <sys/ipc.h>     #include <sys/wait.h>     #include <cstdlib>     #include <cstdio>     #include <vector>      using namespace std;      int l, m, n, id;      struct vektori{             std::vector<long double> a(l);             std::vector<long double> b(l);     };      typedef struct vektori* vektor;      int main(int argc, char* argv[]){             if(argc!=4){                     cout<<"greska kod ulaznih parametara"<<endl;                     return 0;             }             l=atoi(argv[1]);             m=atoi(argv[2]);             n=atoi(argv[3]);             vektor v;             id=shmget(ipc_private, sizeof(vektori), 0);             v=(vektor)shmat(id, null, 0);              return 0;     } 

this errors:

    procesi.cpp:14:29: error: 'l' not type     procesi.cpp:15:29: error: 'l' not type 

add constructor vektor l argument.
use argument initialize members.

struct vektor // assuming meant use vektor, not vektori {     vektor(int l) : a(l), b(l) {}    std::vector<long double> a;    std::vector<long double> b; }; 

and then, in main, use:

vektor v(l); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -