Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

cgi-script in c++ ?

Posted on 1998-01-20
4
Medium Priority
?
146 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 150 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

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

704 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