Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > include / import

Reply
Thread Tools

include / import

 
 
worlman385@yahoo.com
Guest
Posts: n/a
 
      03-13-2008
Is that when ever I want to call any function or use any Class ojbect
/ structure, I will include that .h header file that contain that
Class object?

include <winsock.h>;

It's basically same as Java where I important the Class whenever I
want to use that Class -

import java.lang.String;
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      03-13-2008
wrote:

> Is that when ever I want to call any function or use any Class ojbect
> / structure, I will include that .h header file that contain that
> Class object?


Usually, yes.

> include <winsock.h>;


Remove that semicolon at the end and add a # at the start.

> It's basically same as Java where I important the Class whenever I
> want to use that Class -
>
> import java.lang.String;


Not exactly. The preprocessor will just replace an #include directive with
the code that is contained in the header file. So the following compiler
steps just see the whole thing as if you had copied the header's text into
your source file.

 
Reply With Quote
 
 
 
 
Juha Nieminen
Guest
Posts: n/a
 
      03-13-2008
wrote:
> Is that when ever I want to call any function or use any Class ojbect
> / structure, I will include that .h header file that contain that
> Class object?
>
> include <winsock.h>;


It's not mandatory, but it's the easiest way. (The alternative is more
complicated.)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
#include headers that include this header Aguilar, James C++ 2 07-16-2004 05:56 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Elie Nader C++ 1 11-28-2003 03:12 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Rolf Magnus C++ 2 11-28-2003 12:26 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57