I use g++ to compile my C++ project. When I try to use the clang static analyzer (scan-build) to check my code, I get an error:
>> scan-build g++ main.cpp
could not find clang line
How do I use the scan-build tool with g++?
It appears that scan-build is having trouble recognizing "g++" as the compiler command. It expects "clang" or "gcc". If you replace "g++" with "gcc -lstdc++" to build your project, the scan-build tool will work properly.
>> scan-build gcc -lstdc++ main.cpp
main.cpp:7:3: warning: Assigned value is garbage or undefined
int y = x;
^ ~
1 warning generated.
scan-build: 1 bugs found.
scan-build: Run 'scan-view /var/folders/2l/2l6vhCnVFNad-O8ryd5YO++++TI/-Tmp-/scan-build-2011-09-18-2' to examine bug reports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With