2017-10-19 74 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文件中声明,而不是反过来。

相关问题