来自http://cppcms.com/wikipp/en/page/cppcms_1x_tut_hello_templates
Controller 是:
virtual void main(std::string /*url*/)
{
content::message c;
c.text=">>>Hello<<<";
render("message",c);
}
它说:
but before this we include our
content.h
header
意味着它在不同的文件中,但我不知道它应该在哪里。
最佳答案
before this we include our content.h header
仅意味着 Controller 需要 header content.h
才能使用:content::message c;
(content
命名空间在教程开始时使用)。这只是意味着您应该在 Controller 文件顶部添加:#include "content.h"
。
Controller 文件可以任意命名。然而,本教程希望您在教程结束时将其称为 hello.cpp
。因此,您应该这样调用它(至少在遵循教程时)。
关于c++ - CppCMS模板教程: Where controller should be?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15548708/