Solved

what does mean this error?

Posted on 2008-10-02
3
1,743 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bunnyEars2 challenge 6 132
Specific format 21 197
How to convert MFC::CString to UTF8 wchar_t* 10 209
FMX TCameraComponent Problem 2 69
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…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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