Questions tagged [predefined-macro]

38 questions
0
votes
0 answers

Visual Studio 2019 - define a pragma or macro in launch.vs.json

I need to define a precompiler element(pragma? macro? not sure how you call them) as DEBUG in a cmake project loaded with VS { "version": "0.2.1", "defaults": {}, "configurations": [ { "type": "default", "project":…
0
votes
1 answer

On the confusion of rgb numerical comparison

I wrote a program that gives any RGB value and can find similar colors from the program. But the result is a little confusing. The program is a little long, mainly to fill in some RGB data. The main key points are as follows //MyColor.h #pragma…
anti-gravity
  • 122
  • 6
0
votes
1 answer

Where does predefined macros reside in C?

I wonder where are predefined macros are defined and resided in? Predefined macros are defined in compiler or preprocessor which has a dictionary that hold the pre-defined macros in the source code. I mean __FILE__ macro has a definition and…
0
votes
0 answers

What does this code mean? "#define TO_LITERAL_(text) #text"

When I searched the meaning of __cplusplus, I found a piece of code as following. #include int main() { #define TO_LITERAL(text) TO_LITERAL_(text) #define TO_LITERAL_(text) #text #ifndef __cplusplus /* this translation unit is being…
LittleSoup
  • 31
  • 1
  • 3
0
votes
1 answer

Why compiler gives me error "undefined external symbol" when I don't use libraries?

I've got: frw_trafic.h: #define PI 3.14159265 namespace FRW { float angleToProperRadians(float angle); class Car { public: ... void transform(int time = 1); ... private: ... float velocDir; // angle in degrees, same as Sector angle float…
user7108263
0
votes
1 answer

Is there Predefined-Macros define about byte order in armcc

Is there Predefined-Macros define about byte order in armcc. I am a novice on the armcc.and sorry for my English. In gcc these are macros: __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ __ORDER_BIG_ENDIAN__ __ORDER_PDP_ENDIAN__ ... Now I have to use…
zodiac1111
  • 179
  • 1
  • 2
  • 9
0
votes
4 answers

Why my macro doesn't compile?

#define LINE_FILE ("Line"#__LINE__"of file"__FILE__) int main(void) { printf("%s", LINE_FILE); } What I expected: LINE_FILE = "Line linenumber of file filename" and printf() can output this…
SPiCaRia
  • 121
  • 10
0
votes
2 answers

base file name from __FILE__

I need the file name only where the __FILE__ and __FILEW__ macros return the whole path. I defined the following: #define __FILE_NAME_ONLY__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) I am using it as follows: #define…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
1 2
3