Solved

what does mean this error?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python Encoding Problem \u2013 4 108
Python 2.7 - French characters 6 59
word0 challenge 3 78
Beginner to Unreal Engine 4 5 61
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

867 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

22 Experts available now in Live!

Get 1:1 Help Now