Solved

what does mean this error?

Posted on 2008-10-02
3
1,744 Views
Last Modified: 2012-05-05
Hello Experts,
i got this error while i was compiling with Dev C++
what does it mean??
void main(int argc, char **argv)
 
{
      WORD wVersionRequested = MAKEWORD(1,1);
      WSADATA wsaData;
      int nRet;
 
    
 
      if (argc != 3)
      {
            fprintf(stderr,
                  "\nSyntax: GetHTTP ServerName FullPathName\n");
            return 0;
      }
 
      //
      // Initialize WinSock.dll
      //
      nRet = WSAStartup(wVersionRequested, &wsaData);
      if (nRet)
      {
            fprintf(stderr,"\nWSAStartup(): %d\n", nRet);
            WSACleanup();
            return 0;
      }
      
      if (wsaData.wVersion != wVersionRequested)
      {
            fprintf(stderr,"\nWinSock version not supported\n");
            WSACleanup();
            return 0;
      }
 
      _setmode(_fileno(stdout), _O_BINARY);
 
      
      GetHTTP(argv[1], argv[2]);
 
      WSACleanup();
}

Open in new window

0
Comment
Question by:kagami01
3 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 130 total points
ID: 22622772
Exactly what it says : that main has to return an int (not void).

So :

        int main(int argc, char **argv)

instead of :

        void main(int argc, char **argv)

0
 

Author Comment

by:kagami01
ID: 22622821
great!thank you
0
 
LVL 17

Expert Comment

by:CSecurity
ID: 22622843
if you link winsock.dll to my code, will compile without error
Regards
#include <iostream.h>
#include <windows.h>
 
int main(int argc, char **argv)
 
{
      WORD wVersionRequested = MAKEWORD(1,1);
      WSADATA wsaData;
      int nRet;
 
    
 
      if (argc != 3)
      {
            fprintf(stderr,
                  "\nSyntax: GetHTTP ServerName FullPathName\n");
            return 0;
      }
 
      //
      // Initialize WinSock.dll
      //
      nRet = WSAStartup(wVersionRequested, &wsaData);
      if (nRet)
      {
            fprintf(stderr,"\nWSAStartup(): %d\n", nRet);
            WSACleanup();
            return 0;
      }
      
      if (wsaData.wVersion != wVersionRequested)
      {
            fprintf(stderr,"\nWinSock version not supported\n");
            WSACleanup();
            return 0;
      }
      return 0;
}

Open in new window

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

789 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