我有宣佈在我的頭文件中的一個(C++)函數的一個問題「在此範圍內未聲明」,這是文件的外觀:功能參數在頭文件
#ifndef MACTRANSFERINCLUDE
#define MACTRANSFERINCLUDE
#ifdef USE_MAC
#include <string>
#include <boost/shared_ptr.hpp>
using namespace std;
boost::shared_ptr<wstring> browseFolder();
boost::shared_ptr<vector<wstring>> getFilesInDirRecursiveImplementation(boost::shared_ptr<vector<wstring>> dirs, boost::shared_ptr<vector<wstring>> files);
#endif
#endif
當構建項目(對於XCode中的Mac OSX),我得到''dirs'未在此範圍內聲明。
如果我還聲明函數
boost::shared_ptr<vector<wstring>> foo();
我得到的錯誤「函數調用不能出現在常數表達式」。我不是很熟悉C++,所以任何幫助,將不勝感激。
你在包含你的文件之前包含''? –