[Flightgear-devel] includes in brackets ?
As you know I have limited C/C++ knowledge, but I thought I'd have at least a little bit ;-) Here comes While I'm digging through the sources in the hope to find the cause for some mislead header includes I wondered about notation of several include statements. To my knowledge system includes should be bordered by brackets: #include stdio.h and your own, private header files by quotation marks: #include atis.hxx Could someone please explain to me what is different for example in FlightGear/src/ATC/atis.cxx: #include simgear/compiler.h This is definitely not a system include because it stems from your very private SimGear installation. What did I miss ? Thanks, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] includes in brackets ?
Martin Spott wrote: As you know I have limited C/C++ knowledge, but I thought I'd have at least a little bit ;-) Here comes While I'm digging through the sources in the hope to find the cause for some mislead header includes I wondered about notation of several include statements. To my knowledge system includes should be bordered by brackets: #include stdio.h and your own, private header files by quotation marks: #include atis.hxx Could someone please explain to me what is different for example in FlightGear/src/ATC/atis.cxx: #include simgear/compiler.h This is definitely not a system include because it stems from your very private SimGear installation. What did I miss ? As I understand it, bracket's vs. double quotes tells the compiler how to search for the include file. If a file is listed in brackets (i.e. #include stdio.h) then the compiler searches the standard system include directories like /usr/include, /usr/local/include, /opt/include, and perhaps some deaply buried platform/compiler dependent directories. If the file is enclosed in double quotes (i.e. #include atis.hxx) then the compiler just searches the local directory. MS doesn't really have standard system include directories like unix does, but I assume that brackets would tell the compiler to search through the standard include directories provided by MSVC, where as quotes would tell the compiler to search only the current folder ... not sure about that though ... from the perspective of a unix developer, MSVC does some slightly strange things sometimes. :-) #include simgear/compiler.h is correct form if you've installed simgear in a standard location such /usr/local/include Regards, Curt. -- Curtis Olsonhttp://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/ FlightGear Project http://www.flightgear.org Unique text:2f585eeea02e2c79d7b1d8c4963bae2d ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] includes in brackets ?
Martin Spott wrote: While I'm digging through the sources in the hope to find the cause for some mislead header includes I wondered about notation of several include statements. To my knowledge system includes should be bordered by brackets: It's not really well specified. Usually: using angle brackets means to search the system standard directories, followed by directories specified on the compiler command line; using quotes means to search the directory containing the source file, followed by command line directories. There are two source code conventions I've seen: 1.) Use quotes for all project-local files, even those not in the same directory as the C files including them. Use angle brackets *only* for stuff expected to be installed globally on the system. This has the problem that a common name like config.h might exist in multiple directories and there's no easy way to say I want the one in my own directory please. It makes it difficult to have a local namespace for your own headers in a big project. 2.) Use quotes *only* for things on the local directory, and angle brackets for everything else. I like this one, but I have seen build systems that complain about missing include files because they are specified with angle brackets but not in the system directories. Andy ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] includes in brackets ?
Hi, On Mittwoch 29 Dezember 2004 19:54, Martin Spott wrote: As you know I have limited C/C++ knowledge, but I thought I'd have at least a little bit ;-) Here comes While I'm digging through the sources in the hope to find the cause for some mislead header includes I wondered about notation of several include statements. To my knowledge system includes should be bordered by brackets: #include stdio.h and your own, private header files by quotation marks: #include atis.hxx Could someone please explain to me what is different for example in FlightGear/src/ATC/atis.cxx: #include simgear/compiler.h This is definitely not a system include because it stems from your very private SimGear installation. What did I miss ? Like Andy tells, that is a bit unclear. But you might look at that in the following way: You need to install SimGear as a prerequsite to flightgear. When you install a library the includes get typically installed into /usr/include (I assume --prefix=/usr) Once the library is installed, it is available on this system as well as system libraries and their includes. Greetings Mathias -- Mathias Frhlich, email: [EMAIL PROTECTED] ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] includes in brackets ?
Andy Ross wrote: There are two source code conventions I've seen: Do I understand correctly that 1.) should be the way to go ? Well, I fixed my include problem - it was a stupid mistake that surprisingly never showed up elsewhere, fortunately not linked to notation of include statements ;-) Thanks anyway, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] includes in brackets ?
Mathias Fr??hlich wrote: But you might look at that in the following way: You need to install SimGear as a prerequsite to flightgear. When you install a library the includes get typically installed into /usr/include (I assume --prefix=/usr) Once the library is installed, it is available on this system as well as system libraries and their includes. This depends on if you like to mess with header files in directories where they don't belong. Honestly I would never put any header file into /usr/include/ except those which come with the OS distribution. Cheers, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d