error-[-Werror=unused-but-set-variable]
-
I am getting following error in cpp file while compiling qbs project -
value store to 'variable_name' and never read [clang-analyzer-deadcode.deadstore].Please provide solution on this.
-
I am getting following error in cpp file while compiling qbs project -
value store to 'variable_name' and never read [clang-analyzer-deadcode.deadstore].Please provide solution on this.
@Abhijeet-Gurav
I'm afraid I don't know what "qbs project" is, but if you can change the code it's just saying an expression is assigned to a variable but that variable is not later read. Assuming it's not a coding mistake, you could remove the assignment (e.g. if it'sa = b();you could just haveb();. The error message tells you this is a case of "unused-but-set-variable". If that warning were not an error (-Werror=...makes it an error) the code would compile without changing. -
@JonB qbs is a project manager created a few years ago.
@Abhijeet-Gurav as @JonB wrote, you have that variable_name somewhere in your code that is in fact never used. The solution is to search for it and remove it from your code since it's not used.
-
Thanks @JonB and @SGaist.
You are right, I have removed that variable and now its working fine.
Thanks again for your help.