Skip to main content

All Questions

Filter by
Sorted by
Tagged with
-1 votes
1 answer
108 views

Instantiate different classes according to different compilation flag of same header file in c++

I have a class that varies according to a compilation flag. I would like to instantiate both the versions of the class in the same scope. my_class.h #ifndef MY_CLASS_H #define MY_CLASS_H #ifdef ...
Francesco Vezzi's user avatar
2 votes
1 answer
525 views

Overriding line marker filename in CPP output

At work, we're using GNU CPP as a preprocessor for a custom language. The flow downstream from the preprocessor understands line markers (of the form # 123 foo-bar.extension) and embeds their ...
Rupert Swarbrick at Broadcom's user avatar
0 votes
1 answer
295 views

#define real function name to __noop in Visual C++ 2013

I can do this in Visual C++ 2008 with Release (NDEBUG) setting: debug.h #ifdef _DEBUG void debug_printf(const char* format, ...); #else #define debug_printf(format, v) __noop #endif debug....
null's user avatar
  • 9,104
0 votes
1 answer
591 views

There is the right place to add -U__STRICT_ANSI__ to XCode build settings?

I try to add -U__STRICT_ANSI__ to my project build settings in XCode. But if I add it as "preprocessor macros" the commandline result is -DU__STRICT_ANSI__. XCode adds automatically "D". If I add it ...
Monotomy's user avatar
  • 554
0 votes
1 answer
184 views

What do the include paths/numbers in preprocessed output of icpc (or gcc I guess) mean?

If I use the -E flag when compiling, I get the pre-processed output. Some of the lines in this output is :- # 4 "../Framework.h" 2 # 1 "../Basic.h" 1 # 1 "/usr/include/c++/4.1.2/queue" 1 3 What ...
owagh's user avatar
  • 3,508
4 votes
1 answer
1k views

MSVS C++, how to compile already-preprocessed file with *.i extension?

Related question here: How can I run the MSVC preprocessor and compiler in two separate steps? I explicitly pre-process a MyFile.cpp (not compile) to a MyFile.i. I want to later "compile" that file ...
charley's user avatar
  • 5,949
1 vote
1 answer
1k views

What to use for iOS compiler define

I have the following code that I want to run on Iphone OS, what compiler flag should I use for IOS and where in the below code should it be inserted? Thanks #if defined(__BORLANDC__) || defined (...
tech74's user avatar
  • 1,375
6 votes
4 answers
8k views

C++ adding Debugging code that only runs when Debugging

As the question explains: I would like to add some debugging code that only runs when the program is attached to the debugger. I would imagine that this flag or pre-processor variable would be ...
Wallter's user avatar
  • 4,265
0 votes
5 answers
3k views

What preprocessor directive or other method should I use to discern 32- vs 64-bit environment?

I would like to compile the following C program for 32- and 64-bit systems. #include <stdio.h> ...
Alex Reynolds's user avatar