header-files

Using C struct without including header file

My basic problem is that I want to use some structs and functions defined in a header file by not including that header file in my code. The header file is generated by a tool. Since I don't have access to the header file, I can't include it in my program. Here's a simple example of my scenario: first.h #ifndef FIRST_H_GUARD #define ...

Are the kernel headers required for anything other than compiling glibc and kernel modules?

Hope the question is clear :) ...

C++: Avoid .cpp files with only an empty (de)constructor

Hi, When I have a header file like this: #ifndef GAMEVIEW_H_ #define GAMEVIEW_H_ #include <SDL/SDL.h> class GameView { public: GameView(); virtual ~GameView(); virtual void Update() = 0; virtual void Render(SDL_Surface* buffer) = 0; }; #endif /* GAMEVIEW_H_ */ I need to create a .cpp file like this: #include "GameView.h" Ga...

header files. class and aplication of stacks

when i put the header file in the same folder of the source code. the program doesnt compile. it shows errors. like:7 E:\data structure\asig 5\code.cpp `Queue' has not been declared driver for queue adt. code.cpp #include <iostream> #include "QueueLnk.h" using namespace std; // ********************* Function Prototypes **************...

Header files included in multi .cpp files

Hello. I followed a simple example as below. But compile failed. Could you please have a look and give me some suggestion. vs2010 console application used.Thank you. Error message pgm.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int pgm.h(11): error C2143: syntax error : missing ','...

error C2039: 'string' : is not a member of 'std', header file problem

I am having problems with a class I am writing. I have split the class into a .h file that defines the class and an .cpp file that implements the class. I receive this error in Visual Studio 2010 Express: error C2039: 'string' : is not a member of 'std' This is the header FMAT.h class string; class FMAT { public: FMAT(); ~...

What is purpose of _p.h files?

In Qt Source files, there are two versions of header files, such as: qxmlstream.h qxmlstream_p.h Why are there _p.h files? ...

C/C++: Removing unnecessary includes

Possible Duplicates: C/C++: Detecting superfluous #includes? How should I detect unnecessary #include files in a large C++ project? I'm looking to do some house cleaning in our code base. I would like to start by removing all unnecessary header includes from our source files (*.c and *.cpp). Does anyone know of a tool or te...

How to convert Matlab variables to .dat (text) file with headers

EDITED QUESTION: I have 2500 rows x 100 columns seismic data in variable named avg_seismic_data_models. I also have 2500 rows x 100 columns variable 'X' and similar size matrix variable 'Y', both containing the co-ordinates. I want to save the values of this variable in a text (.dat) file which must have 302 header lines in the followi...

What is the difference between header file and namespace ?

I want to know the exact difference between Header file and namespace in consideration in programming languages ?? ...

Running Geant4 on Win32 system; build errors in VC++

I have Geant4 set-up to run on my Win32 system and have been using cygwin (Linux-like shell) to build the exe files. I figure that VC++ should also be able to build the exe files but I keep getting errors when I only use VC++ to do the project build. After I add all the header files as part of a project, I still can't get it to build. E...

Are there any existing tools to convert c++ header files to header + implementation?

I tend to prototype C++ classes as a self-contained class, i.e. like: class BlahBlahBlah { public: void SomeMethod() { // some code here } }; and then later when I am happy with the design I will turn it into a .h/.cpp pair. This is mostly a mechanical task so is there any tool out there that can help with that? ...

Including C headers inside a C++ program

I have a C++ program (.cpp) inside which I wish to use some of the functions which are present inside the C header files such as stdio.h, conio.h, stdlib.h, graphics.h, devices.h etc. I could include the stdio.h library inside my cpp file as : #include <cstdio>. How do I include the other library files? How do I add the graphics.h libr...

header files in C

how to create user defined header files in C step by step please including the compiling process as well :) SOLVED TY ALL ...

Is there a tool to keep my C source files in order?

I have some C source files that are slowly expanding. I tend to keep the prototypes with documentation in the .h file in good order, grouped into relevant functions and types with #pragma mark. The code is written and documented in a way that requires reading the .h file alongside the .c file. I'd like the files to be ordered in a way th...

Opening the header file to a C/C++ source file with vim from multiple directories and multiple extension.

First off, I was about to write a long list of if/else statements in vim and realized that 1) there was a better way to do what I was trying to do and 2) SO would be ripe with help on the subject. So! I have a variety of files spread about like foo/src/file01.C foo/src/file02.cc foo/src/file03.c foo/include/file01.hh foo/include/file02....

mutually referencial .h files?

I'm pretty sure that I'm going to feel really dumb when I remember how to do this, but here it is: I have two classes A and B. A has an object of type B, B has an object of type A. This is not that unusual. The problem is that A.h needs to import B.h and vice versa. However, one of them has to happen first, and when it does, the use of ...

C++ templates and object code instantiation

With this question I'd like to better understand how C++ templates system works with regards to this question. As far as I know, template-based classes and functions are usually placed into header files. This is due to the technical issue of managing generic data types, which characterstics are unknown in principle. As soon as they are ...

Troubles with errno.h

I'm coding a simple SDL program with VC10. The problem that I am having is at compiling the program: Error 1 error C1083: Cannot open include file: 'errno.h': No such file or directory c:\program files\microsoft visual studio 10.0\vc\include\cerrno 14 Error 2 error C1083: Cannot open include file: 'errno.h': No such file or directory c...

Include file mess

I'm having 2 classes - one holding Entity information other holding Component information. Now the problem is that the Entity class needs Component class already defined for using it in vector of children, but at the same time Component needs Entity to declare it as it's parent (I'm keeping everything linked in between). This puts out st...