c++ - CppCMS模板教程: Where controller should be?

标签 c++ cppcms

来自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/

相关文章:

c++ - 使用未定义的宏构建一个库

c++ - 带有 MS vc 2013 Express 的 CppCMS Hello World 应用程序

c++ - CPPCMS 构建库错误

Cmake:如何仅在文件更新时运行bash命令?

c++ - 是否有链接到 GStreamer 1.0 的 OpenCV 版本?

c++ - 警告 : 'assume_aligned' attribute directive ignored

c++ - 如何使输入接受字符串和整数? C++

c++ - Qt实现函数时keyPressedEvent报错