header-files

Programs configured to use dmalloc bail-out citing header file error

Hi, While trying to compile lynx, I used the 'with-dmalloc' configure option. But compilation aborted, producing this error: /usr/include/dmalloc.h:460: error: expected identifier or '(' before '__extension__' > /usr/include/dmalloc.h:484: error: expected identifier or '(' before '__extension__' > make[1]: *** [HTParse.o] Error 1 > mak...

Something changed, now 5800 compiler errors from precompiled header

I apparently changed something in an iPhone Xcode project, and now when it precompiles the headers I'm getting In file included from [...] /Foundation.framework/Headers/Foundation.h:8, from [...] /UIKit.framework/Headers/UIAccelerometer.h:8, from [...] /UIKit.framework/Headers/UIKit.h:9: /Developer/Plat...

Help a C++ newbie understand his mistakes: header files and cpp files

So I finished my first C++ programming assignment and received my grade. But according to the grading, I lost marks for "including cpp files instead of compiling and linking them". I'm not too clear on what that means. Taking a look back at my code, I chose not to create header files for my classes, but did everything in the cpp files (...

Where can I get these header files?

I'm attempting to compile SndObj, and I need some header files. Which Debian packages do I need to obtain all the missing header files? Checking for C header file alsa/asoundlib.h... (cached) no Checking for C header file soundcard.h... (cached) no Checking for C header file jack/jack.h... (cached) no Checking for C header file m_pd.h.....

Can't include dynamic library header file in more than one file?

I have successfully added a dynamic library to a program, but when I try to include the header file in a second file of the project I get errors about class redeclaration. I will add more info if this isn't enough ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the .txt and just have it included? Something like a PHP include! Does gcc allow this? ...

Precompiling standard library header files - C++

In my project several STL headers are used in different files. I read that, putting all these headers into a single header and using that header in my files will allow compilers to precompile the header which may lead into faster compile time. If I understood it correctly, I need to write like the following. // stl.hpp #include <strin...

C++ header files simple question

Can .h files see what's in each other without being included? I know when I programmed in C before I could use variables in a .h file from other .h files without #include "myfile.h". I'm trying to do the same in C++ and I keep getting "definition out of scope error" ...

what's the differences between .dll , .lib, .h files ?

why in a project should include some *.lib, .h or some other files ? and what are these things used for ? ...

How does C++ handle multiple source files?

I'm studying C++ right now, coming from a background in Python, and I'm having some trouble understanding how C++ handles multiple source files. In Python, the import statement first checks the current working directory for the module you're trying to import and then it checks the directories in sys.path. In C++, where would I place a cu...

C++ header file convention

I am working on a small game using C++, and I used Eclipse CDT's class generator. It created a .h file with the class definitions and a .cpp file that included body-less methods for said class. So if I followed the template, I'd have a .cpp file filled with the methods declarations, and a .cpp file with method bodies. However, I can't ...

Getting included header file path in VC++

Environment: I am using MS-VC++ 6.0, I include a group of header file with some data. The header files change often, so on every change I change the path setting and re-compiler A log file is generated based on the included header files For tracking of the header file from the log file, I wish to print the header file path inside the l...

Why include header in the method definition file?

Hi say you have a source file named sum.c that looks like this: #include "sum.h" int sum(int x, int y) { return x+y; } What's the point of including method's header in it's own definition file? Aren't you supposed to include it only in source files that call the sum function? ...

Self-sufficient header files in C/C++

I recently posted a question asking for what actions would constitute the Zen of C++. I received excellent answers, but I could not understand one recommendation: Make header files self-sufficient How do you ensure your header files are self-sufficient? Any other advice or best-practice related to the design and implementation of he...

How do compilers know where to find #include <stdio.h>?

I am wondering how compilers on Mac OS X, Windows and Linux know where to find the C header files. Specifically I am wondering how it knows where to find the #include with the <> brackets. #include "/Users/Brock/Desktop/Myfile.h" // absolute reference #include <stdio.h> // system relative reference? I assum...

Determine an included header files contribution to total file size

Hello, I am interested in reducing the file size of my application. It is a MFC/C++ application built with MVC++ in Visual Studio 2008. UPX does a good job of reducing the final exe to about 40% of its original size but I would like to reduce it more. MFC must be statically linked in this project. I have tried some methods outlined in ...

Any disadvantage if only using cpp files without separate header files?

I have found some threads that explain why C++ separates .cpp and .h files (e.g. here). I'd be interested to know if it causes any problem if I don't separate them. I don't want to share the object files, so what's the benefit of the separation on a small project? If it just slows down the compilation time, it's not a big deal in my opin...

C++ - What should go into an .h file?

When dividing your code up into multiple files just what exactly should go into an .h file and what should go into a .cpp file? ...

HZ variable not defined

Hey, I'm trying to compile someone's code right now and the person is using a variable HZ (which I think stands for Hertz for the hertz of the cpu) but the compiler is complaining that the variable is not defined. My guess is that the person didn't include the correct header file. So does anyone know which header file, HZ is defined in...

Using C++ header file in vb.net app?

What is the simpliest way to use a C++ header file in a vb.net application? I need to access an API defiend via the header file for a custom VB.NET windows app. ...