0

i tried this but it is not working :

#include <iostream>
#define CAT(A,B) A##B
#define MY_MACRO CAT(__COUNTER__,__LINE__)
int main(){
    std::cout<<MY_MACRO<<std::endl;
    std::cin.get();
    return 0;
}

it generates this error In function int main() error COUNTER____LINE was not declared in this scope

this too not helping :

#include <iostream> 
#define F1(x,y) x##y 
#define F2(x,y) F1(x,y) 
#define MY_MACRO F2(COUNTER,LINE)
 int main()
{
 std::cout<<MY_MACRO<<std::endl;
 std::cin.get(); return 0;
 }

it does not concatenate it just returnes LINE macro value and if you replace it in the code with an integer it will return that integer only not concatenated with COUNTER , so this question is not rellay duplicated

Hassen Dhia
  • 555
  • 4
  • 11

0 Answers0