Solved

cgi-script in c++ ?

Posted on 1998-01-20
4
140 Views
Last Modified: 2013-12-25
Can someoner make a visitor-counter in c++ for me??
0
Comment
Question by:wqclatre
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to dynamically set the form action using jQuery.

706 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

20 Experts available now in Live!

Get 1:1 Help Now