Solved

cgi-script in c++ ?

Posted on 1998-01-20
4
144 Views
Last Modified: 2013-12-25
Can someoner make a visitor-counter in c++ for me??
0
Comment
Question by:wqclatre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:ihelpdesk
ID: 1831848
For free or not for free ?
0
 
LVL 2

Author Comment

by:wqclatre
ID: 1831849
Is this a answer????

To me it looks like a question.?
0
 
LVL 2

Author Comment

by:wqclatre
ID: 1831850
Let's change the question to this. I opened a c++ book in 15  minits and made this:

#include <iostream.h>
#include <fstream.h>

int main()
{
   int count;
   ifstream fin("counter.txt");
   fin>>count;
   count++;
   ofstream fut("counter.txt");
   fut << count;
   cout << "Content-type: text/html\n\n";
   cout << count << endl;
}

Can someone tell me what's wrong with this?

There is two problems:

1. When i try to compile it with gcc counter.cc -o counter under linux (RH 5.0) I get this:

/tmp/cca004431.o: In function `main':
/tmp/cca004431.o(.text+0x1e): undefined reference to `ifstream::ifstream(int, char const *, int, int)'
/tmp/cca004431.o(.text+0x31): undefined reference to `istream::operator>>(int &)'
/tmp/cca004431.o(.text+0x53): undefined reference to `ofstream::ofstream(int, char const *, int, int)'
/tmp/cca004431.o(.text+0x69): undefined reference to `ostream::operator<<(int)'
/tmp/cca004431.o(.text+0x78): undefined reference to `cout'
/tmp/cca004431.o(.text+0x7d): undefined reference to `ostream::operator<<(char const *)'
/tmp/cca004431.o(.text+0x87): undefined reference to `endl(ostream &)'
/tmp/cca004431.o(.text+0x90): undefined reference to `cout'
/tmp/cca004431.o(.text+0x95): undefined reference to `ostream::operator<<(int)'
/tmp/cca004431.o(.text+0xa0): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))'


It compiles when I use g++ or c++.

2.:

When I run it from the prompt It counts and seems to work, but
 when I run it on the www-server it cames to 1 then it stops....

I'l be glad if you can tell me what's stupid with my work to.
0
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 1831851
You can't compile the above program with gcc since it's a C++ program.  You must use g++.  
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question