#include #include "writeshm.h" #include "dogcore.h" #include #include DataWriteShm *dataWriteShm; bool load_shm(){ int shmid; key_t key; if((key=ftok(IPC_PATH,static_cast(IPC_PORT)))==-1){ return false; } if((shmid=shmget(key,sizeof(DataWriteShm),IPC_CREAT|0666))==-1){ return false; } dataWriteShm = static_cast(shmat(shmid,nullptr,0)); return true; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); if(load_shm()){ DogCore *dogcore = new DogCore(nullptr); dogcore->start(); }else{ fprintf(stderr,"load shm err"); exit(1); } return a.exec(); }