In the PRO file of my Qt5 C++ desktop project I have the following declaration:
DEFINES += PROJECT_VERSION=\\\"1.0.0.0\\\"
In the header file of a class, say Foo
, I declare and define a method to obtain the version like this:
QString version() { return PROJECT_VERSION; }
When I try to compile the code, a get the following error:
error: C2065: 'PROJECT_VERSION': undeclared identifier
As shown in the screenshot, PROJECT_VERSION is properly color coded and the tooltip is correct too, for which it seems to me that it is recognized. Then why is this error?
I don't have an idea what could cause this and how such thing is possible in a first place. Any help will be much appreciated.