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.
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>
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
Re: How should the #include statement be used?
Quote:
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.
Re: How should the #include statement be used?
Quote:
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