Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6662161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:21:38+00:00 2026-05-26T02:21:38+00:00

I’m a beginner in C++ server pages. I have tried C++ Server Pages by

  • 0

I’m a beginner in C++ server pages. I have tried C++ Server Pages by micronovae, but couldnt connect ODBC it used to give link error “undefined reference to SQLAllocHandle@12“, I could not resolve it. Similar to micronovae,POCO also provides C++ Server Pages. so thought of try it. I tried one sample from http://pocoproject.org/docs/PageCompilerUserGuide.html#0 .

What I did is, firstly created a file called TimeHandler.html along with following contents inside it:

<%@ page class="TimeHandler" %>
<%!
    #include "Poco/DateTime.h"
    #include "Poco/DateTimeFormatter.h"
    #include "Poco/DateTimeFormat.h"


    using Poco::DateTime;
    using Poco::DateTimeFormatter;
    using Poco::DateTimeFormat;
%>

<%
    DateTime now;
    std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
%>
<html>
<head>
<title>Time Sample</title>
</head>
<body>
<h1>Time Sample</h1>
<p><%= dt %></p>
</body>
</html>

Then, I used the commandline Pagecompiler tool, i.e., CPSPCD from command prompt, and it generated following two files,..

1) TimeHandler.cpp

#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& request, Poco::Net::HTTPServerResponse& response)
{
   response.setChunkedTransferEncoding(true);
   response.setContentType("text/html");

   Poco::Net::HTMLForm form(request, request.stream());
   std::ostream& responseStream = response.send();
   responseStream << "";
   responseStream << "\n";
   responseStream << "";
   responseStream << "\n";
   responseStream << "\n";
   responseStream << "";
#line 13 "C:\\Users\\Admin\\Desktop\\data structures\\vinz\\TimeHandler.html"

    DateTime now;
    std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
   responseStream << "\n";
   responseStream << "<html>\n";
   responseStream << "<head>\n";
   responseStream << "<title>Time Sample</title>\n";
   responseStream << "</head>\n";
   responseStream << "<body>\n";
   responseStream << "<h1>Time Sample</h1>\n";
   responseStream << "<p>";
#line 23 "C:\\Users\\Admin\\Desktop\\data structures\\vinz\\TimeHandler.html"
   responseStream << ( dt );
   responseStream << "</p>\n";
   responseStream << "</body>\n";
   responseStream << "</html>";
}

2) TimeHandler.h

#ifndef TimeHandler_INCLUDED
#define TimeHandler_INCLUDED


#include "Poco/Net/HTTPRequestHandler.h"


class TimeHandler: public Poco::Net::HTTPRequestHandler
{
public:
   void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
};


#endif // TimeHandler_INCLUDED

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….”.

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 how to embed C++ code inside html, compile and run it..!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:21:38+00:00Added an answer on May 26, 2026 at 2:21 am

    The samples you show only create the individual page (handler) implementation.

    You need to add an actual HTTPServer to serve that page.

    See: http://pocoproject.org/docs/Poco.Net.HTTPServer.html

    There is a sample in the sources download under

     poco-1.4.2p1.zip\poco-1.4.2p1\Net\samples\HTTPTimeServer
    

    You should be able to get something working from there

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.