2012-01-10 158 views
0

我已經聲明瞭三個對象指針fstream * output,fstream * input和dialog1 * dlg。幷包含dialog1.h。fstream對象指針

#include<fstream> 
#include "stdafx.h" 
#include "dialog1.h" 
fstream *output; 
fstream *input; 
dialog1 *dlg 

錯誤C2059:語法錯誤: '常數'(約對話框) 錯誤C2143:語法錯誤:缺少 ';'之前'*'
問:當我建立像失蹤的項目錯誤「;」出來了*輸入和*輸出和約* dlg語法錯誤const出來。什麼是聲明這些對象的方式?

+0

確切的錯誤消息和代碼會有幫助。 – Adam 2012-01-10 02:38:58

回答

0

您是否在dialog1.h中定義了一個類並忘記了尾隨分號?

+0

它以分號結尾 – buddy 2012-01-10 05:37:35

0

它看起來像你忘了添加std ::前綴到你的聲明。

std::fstream *output; 

應該工作。

0

編譯器會忽略#include "stdafx.h"之前的標頭。所以你的#include <fstream>沒有效果,請在"#include "stdafx"之後加入。