#include Syntax

Started by
4 comments, last by C-Junkie 19 years, 5 months ago
I want to include a header using a path. Which one would be correct syntax?: #include <C:\DOCUMENTS AND SETTINGS\ADMIN\MY DOCUMENTS\TEST\test.h> or #include <C:\\DOCUMENTS AND SETTINGS\\ADMIN\\MY DOCUMENTS\\TEST\\test.h> Or should I use "" instead of <>?
Advertisement
Use " " and use / or \\, not \.


"There is no dark side of the moon really,
As a matter of fact, its all dark."
#include "whatever.bork" will first look in the current directory for a whatever.bork file, and then, in the 'standard include locations'.

#include <whatever.bork> will directly look for whatever.bork in the 'standard include locations'.

In any case, the preferred syntax is to use forward slashes, not backslashes - even on windows. So you should probably go with

#include "C:/Documents and Settings/Admin/My Documents/Test/test.h"
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Quote:Original post by Fruny
#include "whatever.bork"

Is that the new extension in C++0X?
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Quote:Original post by Arild Fines
Quote:Original post by Fruny
#include "whatever.bork"

Is that the new extension in C++0X?


Basically: lmao.
Quote:Original post by MitchellH
Quote:Original post by Arild Fines
Quote:Original post by Fruny
#include "whatever.bork"

Is that the new extension in C++0X?


Basically: lmao.
nononono. .lmao are inline files.

This topic is closed to new replies.

Advertisement