preprocessor

Header file not found when building under cygwin

I am trying to build a certain library under cygwin (OpenEXR), and I get the following error: b44ExpLogTable.cpp:52:18: error: half.h: No such file or directory half.h is referenced using #include <half.h>, and is actually a part of another library I successfully run make/make install on previously. The question is -- when using #inc...

C preprocessor macros: check if token was declared

This is for the C preprocessor experts: How can I declare an enum with a list of some identifiers and later during the switch-statement check if an identifier was included in the list? Example of what I need: typedef enum { e1, e2, e3, e4, e5, e6 } e; e x; switch (x) { #if DECLARED_IN_ENUM (e1) case e1 : ... #endif /* etc. */ } ...

how to use preprocessors in blackberry to target the code for multiple platforms, any one having any thing on JDE with 4.2 and above

how to use preprocessors in blackberry to target the code for multiple platforms, any one having any thing on JDE with 4.2 and above ...

Preprocessor error in NSLog

Hey Guys, At the moment im driving crazy with a simple problem. I cannot imagine what's wrong here. In BlaBlaBla_prefix.pch I define the following: #import "SMDeviceManager.h" #define DeviceSpecificResourceName(name) [SMDeviceManager deviceSpecificResourceName:(name)]; But if I know use this function in my code inside a NSog()-call...

How to get __FILE__ as absolute path on Intel C++ compiler

I've tried using the /Fc flag which works with visual studio but get a message that it isn't recognized by the intel compiler. I'm trying to write a test which uses data from a directory relative to the cpp test file, however the executable will be deployed elsewhere so it's hard to get it relative to the exe... hence i'd like an absol...

Pass an absolute path as preprocessor directive on compiler command line

Hi all, I'd like to pass a MSVC++ 2008 macro into my program via a /D define like so /D__HOME__="\"$(InputDir)\"" then in my program I could do this cout << "__HOME__ => " << __HOME__ << endl; which should print somethine like __HOME__ => c:\mySource\Directory but it doesn't like the back slashes so I actually get: __HOME__ ...

preprocessor API for Java

Hi, Does anyone know of a Java preprocessor library? I'm searching for something like m4. I could just invoke m4 from Java and capture the result, but I don't want to depend on m4 being installed in the systems where the application runs. A standalone Java API that is similar to m4 would be great. Thanks. edit: I think I didn't explai...

Changing value of preprocessor symbol for testing

I am writing a dynamically growing string buffer. I have the following in a .c file. #ifndef STRBUF_GROWTH_SIZE #define STRBUF_GROWTH_SIZE 4096 #endif My code uses this constant to do the reallocation of the buffer. Now in the tests, I need to set this value to a small one so that I can check the reallocation. I tried defining this in...

Getting boost::function arity at compile time?

I need to make a decision in a BOOST_PP_IF statement based on the arity (parameter count) of a boost::function object. Is this possible? boost::function_types::function_arity does what I'm looking for, but at runtime; I need it at compile time. ...

Preprocessor output

How do I view the output produced by the C pre-processor, prior to its conversion into an object file? I want to see what the MACRO definitions do to my code. ...

Detecting C++0x mode on Intel C++?

Does Intel C++ predefine some macro when compiling with Qstd=c++0x? Something like __GXX_EXPERIMENTAL_CXX0X__ in GCC? __cplusplus is still 199711. Any way to detect C++0x compilation? ...

the role of #ifdef and #ifndef

#define one 0 #ifdef one printf("one is defined "); #ifndef one printf("one is not defined "); In this what is the role of #ifdef and #ifndef, and what's the output? ...

Pre-processor directive to detect iPad

Hello I declare some constants in a header file which need to be different depending on whether it is an iPad or an iPhone app. How would I do this? i.e #ifdef ISIPAD static NSString myconst = @"ipad!"; #else static NSString myconst = @"iphone!"; #endif ...

Token pasting in C

Hi all, After reading about VA_NARG I tried to implement function overloading depending on number of arguments in C using macros. Now the problem is: void hello1(char *s) { ... } void hello2(char *s, char *t) { ... } // PP_NARG(...) macro returns number of arguments :ref to link above // does not work #define hello(...) ...

C-sharp's "#region" & "#endregion" in Java?

Is there something in Java that would allow for structuring the source code as it is done in C# with the pre-processor directives #region and #endregion ? ...

#define with parameters...why is this working?

what is going on here? #define CONSTANT_UNICODE_STRING(s) \ { sizeof( s ) - sizeof( WCHAR ), sizeof(s), s } . . . . UNICODE_STRING gInsufficientResourcesUnicode = CONSTANT_UNICODE_STRING(L"[-= Insufficient Resources =-]"); this code is working. I need to see the pre-processors expansion. and whats ...

Is it possible to set preprocessor macro in sln file and not in a project? (VS2008 c++)

I am maintaining a large codebase and some vcproj files are used in different solutions. Due to some horrendous configuration and dependencies it seems the best way to handle some build issues is to #ifdef the code but in order to do that I need to set a preprocessor definition at the solution file level and not at the vcproj level. Is...

How to test if preprocessor symbol is #define'd but has no value?

Using C++ preprocessor directives, is it possible to test if a preprocessor symbol has been defined but has no value? Something like that: #define MYVARIABLE #if !defined(MYVARIABLE) || #MYVARIABLE == "" ... blablabla ... #endif EDIT: The reason why I am doing it is because the project I'm working on is supposed to take a string from ...

Is there a way to debug preprocessed code in VisualStudio

Hi, I've a visual C++ project I'd like to debug. However, several functions are actually generated by macro expansion ( like set##Name for a particular property). So, while debugging I can't follow the execution flow inside these generated functions. Do I have to use the /P flag and then debug the preprocessed code ? thanks for the he...

Combining C++ and C - how does #ifdef __cplusplus work?

I'm working on a project that has a lot of legacy C code. We've started writing in C++, with the intent to eventually convert the legacy code, as well. I'm a little confused about how the C and C++ interact. I understand that by wrapping the C code with extern "C" the C++ compiler will not mangle the C code's names, but I'm not entire...