|
-
Jul 28th, 2010, 03:03 PM
#1
Thread Starter
Frenzied Member
How should the #include statement be used?
Is it like this?
Code:
#include "thing to be included"
or this?
Code:
#include <thing to be included>
I've seen both, but I'm not sure which is correct.
And also what is the "using" statement for? How is it different than "include"? I've seen it used in code examples before but I don't know what it does.
-
Jul 29th, 2010, 01:11 PM
#2
Addicted Member
Re: How should the #include statement be used?
im sure both can be used but i usually use <>
like
#include<iostream>
or
#include<math.h>
-
Jul 29th, 2010, 01:36 PM
#3
Re: How should the #include statement be used?
It's been a few years since I used C ... OK, ten ... but the difference is the location in which the included resource is found:
#include <stdio.h> // Locates and loads stdio.h in where the LIB environment variable points to.
#include "stdio.h" // Loads stdio.h in the current directory.
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
-
Jul 29th, 2010, 11:17 PM
#4
Thread Starter
Frenzied Member
Re: How should the #include statement be used?
 Originally Posted by Max Peck
It's been a few years since I used C ... OK, ten ... but the difference is the location in which the included resource is found:
#include <stdio.h> // Locates and loads stdio.h in where the LIB environment variable points to.
#include "stdio.h" // Loads stdio.h in the current directory.
-Max
In which situation should I use each? They both seem to work when I tried it for the same use in the program.
-
Aug 8th, 2010, 12:36 PM
#5
Re: How should the #include statement be used?
 Originally Posted by Ben321
In which situation should I use each? They both seem to work when I tried it for the same use in the program.
I would use #include "resource.h" with header files I've created because I'll generally place them in the same folder with the project.
#include <resource.h> is for standard library includes that you don't modify.
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|