cgi-script in c++ ?

Posted on 1998-01-20
Last Modified: 2013-12-25
Can someoner make a visitor-counter in c++ for me??
Question by:wqclatre
  • 2

Expert Comment

ID: 1831848
For free or not for free ?

Author Comment

ID: 1831849
Is this a answer????

To me it looks like a question.?

Author Comment

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");
   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 -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++.


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.
LVL 32

Accepted Solution

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++.  

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 47
Need some help in modifying Powershell script to show open files in File server 5 92
Python Encoding Problem \u2013 4 104
Ready Made PHP Scripts 5 62
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now