Go Premium for a chance to win a PS4. Enter to Win


cgi-script in c++ ?

Posted on 1998-01-20
Medium Priority
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 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++.


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 150 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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 …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

971 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