Overview
Features
Download
Documentation
Community
Add-Ons & Services

ServerApplication error

Please post support and help requests here.

ServerApplication error

Postby vdvleon » 04 Dec 2009, 04:18

I am writing my own CMS/MVC system in Poco. But i have some problems.

My code:

Code: Select all
int main(int argc, char* argv[]){
   vdCMS::Server app;
   return app.run(argc, argv);
}


Code: Select all
class Server : public Poco::Util::ServerApplication{
   protected:
      int main(std::vector<std::string>& args);
};
int Server::main(std::vector<std::string>& args){
   std::cout << "main()" << std::endl;

   // HTTPServer stuff (with waitForTerminationRequest() ... )

   return Application::EXIT_OK;
}


The text "main()" never appears and the program close immediately.

I compile it with g++ on Linux (Ubuntu x86). I just start the program with: ./a.out

Does anybody know what the problem can be?
vdvleon
 
Posts: 4
Joined: 04 Dec 2009, 04:11
Location: Nijmegen, The Netherlands

Re: ServerApplication error

Postby distortedskies » 04 Jan 2010, 18:34

You need to add a const to the main in the server class. The code should look like this.
Code: Select all
class Server : public Poco::Util::ServerApplication{
   protected:
      int main(const std::vector<std::string>& args);
};
int Server::main(const std::vector<std::string>& args){
   std::cout << "main()" << std::endl;

   // HTTPServer stuff (with waitForTerminationRequest() ... )

   return Application::EXIT_OK;
}
distortedskies
 
Posts: 1
Joined: 04 Jan 2010, 18:29


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron