header-files

What is the reason for #pragma once inside header guards?

Just seen this inside <boost/asio.hpp> #ifndef BOOST_ASIO_HPP #define BOOST_ASIO_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) /// .... #endif // BOOST_ASIO_HPP Disregarding the _MSC_VER preprocessor checks, what is the benefit of having the #pragma once in this case...

Compiler not following symbolic links in Visual Studio C++

I am using Visual Studio 2008 C++ project (Visa 32 bit). I have the following #include directive in my source code. #include <example/header.h> In my include path I specify the parent directory of 'example', i.e. C:/.../include where the full path to the header looks like C:/.../include/example/header.h However, 'example' is a ...

where to document functions in C

I have a C program with multiple files, so I have, for example, stuff.c which implements a few functions, and stuff.h with the function prototypes. How should I go about documenting the functions in comments? Should I have all the docs in the header file, all the docs in the .c file, or duplicate the docs for both? I like the latter appr...

A basic understanding of C++ header files

I have a theory question rather than an error report. I'm a rookie C++ programmer, trying to promote that away Using the VC++ VS2008 compiler I am often finding myself wondering WHY I want to take some actions in header files. For example look at this code block: #include "DrawScene.h" #include "Camera.h" #include "Player.h" #includ...

Problem with header files & c++ files

Hi, I'm creating a minimal circle-circle physics engine in a static library, and I've came across a problem. I have a header file for object manipulation, one of the variables is the objects position. The position variable is declared in bpObject.h, and I have a void function, SetPosition(), that accesses the current position and sets ...

Are there tools that help organizing #includes?

Are there any tools that help organizing the #includes that belong at the top of a .c or .h file? I was just wondering because I am reorganizing my code, moving various small function definitions/declarations from one long file into different smaller files. Now each of the smaller files needs a subset of the #includes that were at the ...

PHP File Download

Hello, I'm currently building a script that will allow a user to download a file via a URL without actually seeing the filename or where the file is stored. So far I have everything built out, but I need to know how I would go about calling the file to open and download. I currently have a working version (code below), but for some re...

Header files linked to from header file not found.

Hi everybody I have a problem with Nvidia's OpenCl/Cuda framework, but I think it is a gcc linking issue. The opencl_hello_world.c example file uses following header file: #include "../OpenCL/common/inc/CL/opencl.h" with opencl.h using these header files: #include <../OpenCL/common/inc/CL/cl.h> #include <../OpenCL/common/inc/CL/cl_...

Gcc fails to recognize `-I../path`.

Hi, I have a problem with linking and gcc, probably resulting from a stupid mistake on my side. Drawing from this post Header files linked to from header file not found, I tried the -I option to inlcude header files, but gcc just does not seem to recognize the parameter. ~/Documents/projects/opencl/NVIDIA_GPU_Computing_SDK/src_l$ gcc ...

`#import "FBConnect.h"` vs. '#import "FBConnect/FBConnect.h" '

It took me some time to get XCode to locate the Facebook sdk. I added ‘....../facebook-ios-sdk/src ‘ into ‘Header Search Paths’ in ‘Project Settings’ (the ‘Header Search Paths’ in the ‘Target Info’ does not show the directory however) , and use: #import "FBConnect.h" , instead of #import "FBConnect/FBConnect.h", then the XCode can ...

Unresolved inclusion: <conio.h>. Why?

While running a simple c program I receive an Unresolved inclusion: <conio.h> What am I missing? I am using eclipse on fedora 13. Please help me resolve this problem. If I am missing any file or haven't installed anything let me know. Also I am new to fedora. Guide me with proper steps please. Thanks in advance. ...

Regarding stdio.h

Hi everyone, Confession: I am a novice. Question: I was checking out stdio.h, but I could not find the definition of the fopen function. Can somebody please tell where can I find the definition? regards, bug. ...

How do you organize your class definitions and declarations?

I'm ending my first internship and my boss has shown me a few of his own programming techniques, but one bothers me some. When I write a class header, I like the corresponding source file to linearly list the functions in order that they were declared in the header file. Every time I add a function to the source file, I put it in the ord...

Can VS 2010 check/update header files automatically?

Hello! That's pretty much my question: can VS 2010 check and update header files in C++ code automatically? And can VS 2010 automatically generate a cpp file from a header file, saving you the time to copy the function definitions from the header file? I mean, can it figure that there's no implementation for some method and generate an ...

Including header files in VS2005

How do you include header files from top-level and sub-directories in c++? ...

Raise child_exception Errno 2

I'm attempting to convert a C header into a Python library using ctypes and ctypeslib. I'm running Python 2.7, on OSX 10.6.4 (Snow Leopard). The header-file I am converting is mcbcio32.h, located in /header/mcbcio32.h I wish to create an xml output in the same folder, named mcbcio32.xml. I run h2xml.py (which converts the c header into ...

Condensing Declaration and Implementation into an HPP file.

I've read a few of the articles about the need / applicability / practicality of keeping headers around in C++ but I can't seem to find anywhere a solid reason why / when the above should or should not be done. I'm aware that boost uses .hpp files to deliver template functions to end users without the need for an associated .cpp file, a...

Where is skbuff.h file in Ubuntu?

I read in many books that path for skbuff.h is usr/include/linux. I searched in Ubuntu, fedora and backtrack but can't find the header file. Can anybody help me to find this file? Thanks in advance. ...

C++ Does not name to a type

This might be an easy question, but I cannot figure out why the compiler it's giving me this error. I have two classes. Agent and Environment. WHen I try to add an object of type Agent in my Environment class I get Agent does not name to a type error. I am including Agent.h in my Environment.h class #ifndef AGENT_H_INCLUDED #define AGE...

Basic stucture of a C/C++ project (header files and cpp files)

Hello, This is a brain-dead newbie question, but here goes: What determines what files get included in a C/C++ project? My understanding is that the compiler starts with the file that has main() in it and that file will contain #include's to get various h files which contain #include's to other h files and so on until everything is in...