title: How do I run POCO C++ server pages?
body: <p>I'm a beginner in C++ server pages. I have tried <strong>C++ Server Pages</strong> by micronovae, but couldnt connect ODBC it used to give link error "<code>undefined reference to SQLAllocHandle@12</code>", I could not resolve it. Similar to micronovae,POCO also  provides C++ Server Pages. so thought of try it. I tried one sample from <a href="http://pocoproject.org/docs/PageCompilerUserGuide.html#0" rel="nofollow">http://pocoproject.org/docs/PageCompilerUserGuide.html#0</a> .</p>
  
  <p>What I did is, firstly created a file called TimeHandler.html along with following contents inside it:</p>
  
  <pre><code>&lt;%@ page class="TimeHandler" %&gt;
  &lt;%!
      #include "Poco/DateTime.h"
      #include "Poco/DateTimeFormatter.h"
      #include "Poco/DateTimeFormat.h"
  
  
      using Poco::DateTime;
      using Poco::DateTimeFormatter;
      using Poco::DateTimeFormat;
  %&gt;
  
  &lt;%
      DateTime now;
      std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
  %&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Time Sample&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Time Sample&lt;/h1&gt;
  &lt;p&gt;&lt;%= dt %&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Then, I used the commandline Pagecompiler tool, i.e., CPSPCD from command prompt, and it generated following two files,..</p>
  
  <p>1) TimeHandler.cpp</p>
  
  <pre><code>#include "TimeHandler.h"
  #include "Poco/Net/HTTPServerRequest.h"
  #include "Poco/Net/HTTPServerResponse.h"
  #include "Poco/Net/HTMLForm.h"
  
  
  #line 2 "C:\\Users\\Admin\\Desktop\\data structures\\vinz\\TimeHandler.html"
  
      #include "Poco/DateTime.h"
      #include "Poco/DateTimeFormatter.h"
      #include "Poco/DateTimeFormat.h"
  
  
      using Poco::DateTime;
      using Poco::DateTimeFormatter;
      using Poco::DateTimeFormat;
  
  
  void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest&amp; request, Poco::Net::HTTPServerResponse&amp; response)
  {
     response.setChunkedTransferEncoding(true);
     response.setContentType("text/html");
  
     Poco::Net::HTMLForm form(request, request.stream());
     std::ostream&amp; responseStream = response.send();
     responseStream &lt;&lt; "";
     responseStream &lt;&lt; "\n";
     responseStream &lt;&lt; "";
     responseStream &lt;&lt; "\n";
     responseStream &lt;&lt; "\n";
     responseStream &lt;&lt; "";
  #line 13 "C:\\Users\\Admin\\Desktop\\data structures\\vinz\\TimeHandler.html"
  
      DateTime now;
      std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
     responseStream &lt;&lt; "\n";
     responseStream &lt;&lt; "&lt;html&gt;\n";
     responseStream &lt;&lt; "&lt;head&gt;\n";
     responseStream &lt;&lt; "&lt;title&gt;Time Sample&lt;/title&gt;\n";
     responseStream &lt;&lt; "&lt;/head&gt;\n";
     responseStream &lt;&lt; "&lt;body&gt;\n";
     responseStream &lt;&lt; "&lt;h1&gt;Time Sample&lt;/h1&gt;\n";
     responseStream &lt;&lt; "&lt;p&gt;";
  #line 23 "C:\\Users\\Admin\\Desktop\\data structures\\vinz\\TimeHandler.html"
     responseStream &lt;&lt; ( dt );
     responseStream &lt;&lt; "&lt;/p&gt;\n";
     responseStream &lt;&lt; "&lt;/body&gt;\n";
     responseStream &lt;&lt; "&lt;/html&gt;";
  }
  </code></pre>
  
  <p>2) TimeHandler.h</p>
  
  <pre><code>#ifndef TimeHandler_INCLUDED
  #define TimeHandler_INCLUDED
  
  
  #include "Poco/Net/HTTPRequestHandler.h"
  
  
  class TimeHandler: public Poco::Net::HTTPRequestHandler
  {
  public:
     void handleRequest(Poco::Net::HTTPServerRequest&amp; request, Poco::Net::HTTPServerResponse&amp; response);
  };
  
  
  #endif // TimeHandler_INCLUDED
  </code></pre>
  
  <p>And then I created new project in VS 2010 and added these two files and compiled. There were few issues, but later I updated environment variables and it went on fine. But there is one last error, "....Unresolved symbol _main....".</p>
  
  <p>There was no main inside it.. so how do I run this program??
  if not this program, atleast would someone give an overview as to <strong>how to embed C++ code inside html, compile and run it..!</strong></p>