I have a question about this error from g++ on linux:
srcs/../incs/file.hpp:21:27: error: taking address of temporary array
# define KEY_ESC_ (char[]){27, 0, 0, 0, 0, 0, 0}
^~~~~~~~~~~~~~~~~~~~~~
srcs/main.cpp:91:16: note: in expansion of macro 'KEY_ESC_'
This is in a define as you can see. I don't understand why g++ say taking address of temporary array
It's more global than temporary...
This value is the key escape got from read
Any way ...
How can I solve it?
This code works on osx, but I need gross-compilation on linux ...
Thank you
If you use a define statement, all instances of
KEY_ESC_in your code will be literally replaced by(char[]) {27, 0, 0, 0, 0, 0, 0},which will at that point in your code become a temporary variable.