2017-10-19 72 views
0

我已經看着下面的答案存在,但他們沒有回答我的問題:生成CPP文件,如果沒有在Visual Studio 2015年

Fast way to generate code functions from header functions in Visual Studio?

Auto-create implementation in Visual Studio C++ 2010

Creating .cpp files from .h files visual studio

當我創建一個.h文件並定義一個帶有成員函數的類時,如果我右鍵單擊該成員函數並選擇Quick Actions and Refactorings...然後Create Declaration/Definition ,如果相應的.cpp不存在,我得到錯誤信息Cannot open file. We were unable to file myClass.cpp. It may have been moved, renamed or deleted.

如果我手動創建.cpp文件,一切工作正常。我想知道的是,如果有一個設置可以更改,以便如果相應的.cpp文件尚不存在,它會創建它並放入方法存根?

我也知道,Project -> Add Class...都將創建.h.cpp一次,但我所要求的狹窄的情況下,當我已經有了一個.h沒有.cpp

回答

-1

我不明白爲什麼你有.h文件之前有一個.cpp文件。 .hpp應該在.cpp文件中聲明,而不是反過來。

相關問題