header-files

Objective C - Error: 'Expected a type'

南楼画角 提交于 2019-12-03 01:57:20
I'm getting a very strange error on something that I would have thought to be simple. #import <Foundation/Foundation.h> #import "ViewController.h" #import "GameObject.h" @interface GameController : NSObject @property (strong) GLKBaseEffect * effect; @property (strong) NSMutableArray * gameObjects; @property (strong) NSMutableArray * objectsToRemove; @property (strong) NSMutableArray * objectsToAdd; + (GameController *) sharedGameController; - (void) tick:(float)dt; - (void) initializeGame: (ViewController*) viewcontroller;//ERROR: EXPECTED A TYPE - (void) createObject:(Class) objecttype

Should I define static inline methods in header file?

安稳与你 提交于 2019-12-03 01:13:28
问题 I've read about how it is usually best not to define anything in header files because redundant copies are made for every other file that includes the header file. However, in the case of static inline methods, it appears that I have to define it on the spot (at least visual studio 2010 doesn't let me do that). So if I write an interface at the header file, I can't define the static inline method out side of the class definition or at the .cpp file. So, should I bother to use static inline

How do C++ header files work?

与世无争的帅哥 提交于 2019-12-03 00:20:35
When I include some function from a header file in a C++ program, does the entire header file code get copied to the final executable or only the machine code for the specific function is generated. For example, if I call std::sort from the <algorithm> header in C++, is the machine code generated only for the sort() function or for the entire <algorithm> header file. I think that a similar question exists somewhere on Stack Overflow, but I have tried my best to find it (I glanced over it once, but lost the link). If you can point me to that, it would be wonderful. You're mixing two distinct

C header issue: #include and “undefined reference”

不想你离开。 提交于 2019-12-02 22:26:05
Alright, I've been trying to work with this for the longest time, and I simply can't seem to get it to work right. I have three files, main.c , hello_world.c , and hello_world.h . For whatever reason they don't seem to compile nicely, and I really just can't figure out why... Here are my source files. First hello_world.c: #include <stdio.h> #include "hello_world.h" int hello_world(void) { printf("Hello, Stack Overflow!\n"); return 0; } Then hello_world.h, simple: int hello_world(void); And then finally main.c: #include "hello_world.h" int main() { hello_world(); return 0; } When I put it into

How to avoid #include dependency to external library

送分小仙女□ 提交于 2019-12-02 20:47:05
If I'm creating a static library with a header file such as this: // Myfile.h #include "SomeHeaderFile.h" // External library Class MyClass { // My code }; Within my own project I can tell the compiler (in my case, Visual Studio) where to look for SomeHeaderFile.h. However, I don't want my users to be concerned with this - they should be able to include my header without having to inform their compiler about the location of SomeHeaderFile.h. How is this type of situation normally handled? This is a classic "compilation firewall" scenario. There are two simple solutions to do: Forward-declare

Where are the opencv2 include files?

断了今生、忘了曾经 提交于 2019-12-02 20:36:32
I'm struggling to find the include files that should be in a directory names "opencv2"! I've downloaded OpenCV-2.4.0.tar.bz2 from here and extracted the files and ran cmake, which seemed to build the library successfully. The problem is that under the "include" directory for "opencv2" there seem to be tons of header files missing. The only header file there at the moment is "opencv.hpp", which includes a whole set of other files which aren't there. Does anyone have any idea where I can get these files from? Thanks! The header files of the modules are in their own directories. E.g., you can

The workspace with the iOS project and related a static library project

為{幸葍}努か 提交于 2019-12-02 19:39:55
I am fighting with Xcode 4 workspaces. Currently Xcode 4 wins. Thus, my situation: I have the workspace with the iOS app project. There is also static library project iOS app depends on in the this workspace. Solution #1 I try to configure like this: the app project: add to target's Build Phases > Link Binary With Library a product ( libmystaticlib.a ); set USER_HEADER_SEARCH_PATHS to $(TARGET_BUILD_DIR)/usr/local/include $(DSTROOT)/usr/local/include ; the static library project: add some header files to target's Build Phases > Copy Headers > Public ; set SKIP_INSTALL to YES . And important

Cross-Platform C++ code and single header - multiple implementations

落爺英雄遲暮 提交于 2019-12-02 18:23:17
I have heard that a way to write Cross Platform c++ code is to define classes as follows (for example, a Window class): window.h window_win32.cpp window_linux.cpp window_osx.cpp and then choose the implementation file accordingly. But what if i have members of that class that are relative to the os? Like a HWND member for the Win32 implementation. I can't put it in the window.h or when i'd try to compile it on, say, Linux, it'd generate a compiler error. Do i need to #ifdef it? I've already asked a similar question but this one is more focused on this particular problem. There is more ways to

xCode 4.4 does not get all the .pch file headers imports?

女生的网名这么多〃 提交于 2019-12-02 15:51:17
This is my .pch file - // // Prefix header for all source files of the 'English Club' target in the 'English Club' project // #import <Availability.h> #ifndef __IPHONE_4_0 #warning "This project uses features only available in iOS SDK 4.0 and later." #endif #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import "Helper.h" #import "Animations.h" #import "Constants.h" #import "SoundPlayer.h" #import "UAirship.h" #import "UAStoreFront.h" #import "UIIMagesNames.h" #import "UIView+Sizes.h" #import "HelpButton.h" #import "SoundPlayer.h"

Should I define static inline methods in header file?

﹥>﹥吖頭↗ 提交于 2019-12-02 14:32:06
I've read about how it is usually best not to define anything in header files because redundant copies are made for every other file that includes the header file. However, in the case of static inline methods, it appears that I have to define it on the spot (at least visual studio 2010 doesn't let me do that). So if I write an interface at the header file, I can't define the static inline method out side of the class definition or at the .cpp file. So, should I bother to use static inline methods at all? And a relate question: Should I even define anything method or variable in a header file