header-files

error: expected specifier-qualifier-list before 'GKPeerPickerController

I keep getting this message (in the title). Just take a quick look at my code if you want to see what I'm doing. I've just started implementing the Peer Picker, so I'm not completely done yet. I just need some advice/help in the first part. The error shows up in the .m file between the two #import statements, which means it has to be som...

using header files from another project (directory)

I am using visual studio 2008 and I need to use certain header files from another project. I have tried to do add the path in "Additional Include Directories" in C/C++ General properties pane but my project still puts out the same errors (fatal error C1083: Cannot open include file: 'tools/rcobject.h'. All the other cpp and header files...

C++ include file browser

I have a very large project with tons of convoluted header files that all include each other. There's also a massive number of third-party libraries that it depends on. I'm trying to straighten out the mess, but I'm having some trouble, since a lot of the time I'll remove one #include directive only to find that the stuff it was includ...

Removing a compiled method from the .h file and its consequences

I have a binary that has always existed. It has a class C that it has always existed as well. We have to introduce a new method M to the class C but we only want some users to be aware of the existence of such method M. By removing from the .h file such method, which problem we can introduce? Will such approach be backward compatible? ...

mqueue.h not found

Hi all In one of my application, I am using "mqueue.h". I was able to compile and execute it. But one of our customer to whom I released the code, is complaining something like * mqueue.h is not found * He has not attached the exact error message though. In my linux PC, it is available in /usr/include. Can anyone guess any reason why ...

Open-source tool to visualize C/C++ header file dependencies?

What I'm looking for is a tool that, given a root source file, outputs a graph of file dependencies (with some customization thrown in, of course, like --maxdepth, etc.) ...

Can an enum be defined in the same file as a class header that uses it in Objective-C?

If not, and it needs to be included in a separate file (e.g. MyEnums.h) do I need to #import MyEnums.h every time a .m or .h file wants to refer to the type or one of the values? Here's sample code of MyClass.h: #import <Foundation/Foundation.h> // #1 placeholder @interface MyClass : NSObject { } // #2 placeholder - (void)sampleM...

C : Code still runs without any includes (Bloodshed's Dev-C++)

I am currently learning and experimenting with C and am using Bloodshed's DEV-C++ as an IDE. Now, I just realized that the following piece of code (as it is...no includes or nothing) compiles and runs : main () { printf("%d", strlen("hello")); } Now, if I'm not mistaken, shouldn't two header files be included in this source fo...

Why don't C header files increase the binary's size?

I wrote the following C++ program class MyClass { public: int i; int j; MyClass() {}; }; int main(void) { MyClass inst; inst.i = 1; inst.j = 2; } and I compiled. # g++ program.cpp # ls -l a.out -rwxr-xr-x 1 root wheel 4837 Aug 7 20:50 a.out Then, I #included the header file ios...

Header Search Paths in XCode - Is it possible to set a macro or variables so they're relative to the SDK version?

Update: It appears that a recent XCode update may have changed this macro, please see this Question & Answer for more information: http://stackoverflow.com/questions/2292694/obtaining-older-sdkroot-behavior-in-xcode Situation: I'm using libxml2 on an iPhone project and I've added it as relative to the SDK version. However, in order to...

C++ Yet another linker problem.

Hi all. I'm having a linking issue with a basic C++ program. No, I'm not including .cpp files! This is what's happening. main.cpp #include "header.h" #include <iostream> int main() { std::cout << "Hello!"; } header.h #ifndef _HEADER_H #define _HEADER_H class Something { public: printContents(); }; #endif something.cpp ...

Tools to find included headers which are unused?

I know PC-Lint can tell you about headers which are included but not used. Are there any other tools that can do this, preferably on linux? We have a large codebase that through the last 15 years has seen plenty of functionality move around, but rarely do the leftover #include directives get removed when functionality moves from one im...

what is winver?

I was looking at some code and they had this line: #define WINVER 0x0501 in stdafx.h file? Why do you need to define WINVER? How does it affect your code? Can someone please explain? ...

Built in header file parser in C#?

I was wondering if there was a built in runtime parser for header files in C#. I have several different C header files that I want to parse (They will later be used to determine how a network packet will be deserialized). Ideally, some option to load the .h file dynamically, create the struct, and then use reflection to somehow parse t...

C++: Including header-file fails compilation but including source cpp file compiles.

This is probably really simple, but it's hindering me on my way down c++ road. I am currently reading through accelerated c++ and I decided to overkill one of the exercises. It all worked well and my code ran fine until I split it into a header and separate source file. When I import my .cpp source file containing some functions I wrote,...

separating compilation for to avoid recompilation when I add some debugging to .h file

I have a .h file which is used almost throughout the source code (in my case, it is just one directory with. .cc and .h files). Basically, I keep two versions of .h file: one with some debugging info for code analysis and the regular one. The debugging version has only one extra macro and extern function declaration. I switch pretty re...

Header file-name as argument

Objective: I have a list of header files (about 50 of them), And each header-file has few arrays with constant elements. I need to write a program to count the elements of the array. And create some other form of output (which will be used by the hardware group). My solution: I included all the 50 odd files and wrote an application. An...

Is including resource.h in precompiled header a good idea?

The VS-IDE will write //{{NO_DEPENDENCIES}} to resource header files. This comment is actually a feature that prevents (unnecessary) rebuilding of cpp files that include the resource header. But, like stated in the MSDN, this can lead to "undesirable side-effects". In our project we do have the resource.h included in the stdafx.h for p...

VS 2005 doesn't detect changes in header files of C++ project

Very often, actually most of the times, Visual Studio2005 doesn't detect that some header included in some CPP file C++ project was changed. As the consequence, it doesn't recompile the project if only header is changed. It doesn't depend on the "precompiled headers" settings. It doesn't happen in VS 2006 but in every version of VS 2005...

Is it a good practice to always create a .cpp for each .h in a C++ project ?

Some classes, like exceptions or templates, only need the header file (.h), often there is no .cpp related to them. I have seen some projects were (for some classes) there aren't any .cpp files associated to the headers files, perhaps because the implementation is so short that it is done directly in the .h, or maybe for other reasons,...