c 使用list出現錯誤

2021-06-04 00:59:55 字數 745 閱讀 1678

在做多執行緒訪問的時候,想使用list作為儲存佇列,加佇列的時候出現如下錯誤:

d:\vcfile\c++(2012-02-20 after)\sampletest\testmutex.h(31) : error c2143: syntax error : missing ';' before '<'

d:\vcfile\c++(2012-02-20 after)\sampletest\testmutex.h(31) : error c2501: 'list' : missing storage-class or type specifiers

d:\vcfile\c++(2012-02-20 after)\sampletest\testmutex.h(31) : error c2059: syntax error : '<'

d:\vcfile\c++(2012-02-20 after)\sampletest\testmutex.h(31) : error c2039: 'iterator' : is not a member of '`global namespace''

d:\vcfile\c++(2012-02-20 after)\sampletest\testmutex.h(31) : error c2238: unexpected token(s) preceding ';'

首先感覺是沒有加標頭檔案

#include

但是重新編譯還是出現如上錯誤,在網上搜尋到,才發現,忘記加

using namespace std;

linux使用shared ptr出現錯誤

我在不同的系統下採用下面的方式使用shared ptr以及vector std vector pointer arrays std vectorbject const iterator pointer iter 並採用如下初始化 const std shared ptrobject new obje...

使用QTimer時出現的錯誤

在使用qtimer時,我將本來放在訊號與槽連線的專有函式中的中 connect stimtimer,qtimer timeout,this,mainwindow displaytime 移到了stimtimer start 1000 的後面,這個槽函式的功能是實現乙個計時器。結果出現了第一次開啟定時...

使用標準模板庫map出現錯誤C2784,C2676

使用map過程中,出現以下錯誤 error c2784 bool std operator const std reverse iterator ranit const std reverse iterator ranit2 無法從 過載函式型別 為 const std reverse iterat...