Solved

what does mean this error?

Posted on 2008-10-02
3
1,740 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
Comment Utility
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
Comment Utility
great!thank you
0
 
LVL 17

Expert Comment

by:CSecurity
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordlen challenge 3 46
Change to event 1 72
Arduino EDI - Programming language 3 60
Which Linux flavors will this run on? 6 30
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

12 Experts available now in Live!

Get 1:1 Help Now