CLion not recognizing strcmp() function !
已回答
I am not able to use strcmp() function.
It says that it is defined in string.h and I've included it but it is not recognizing.
请先登录再写评论。
Hello!
I see no warnings in CLion 2020.1.1 for the sample code from https://en.cppreference.com/w/cpp/string/byte/strcmp, for example:
Do you see the warnings for this exact code on your side? If no, then the issue is related to your particular code and we will need a short self-contained code sample.
I'm not able to see any warnings on the example code but my code shows warning messages!
Please Help!
Regards,
Rohit
This is the code.
What compiler do you use? Please attach a screenshot of `File | Settings | Build, Execution, Deployment | Toolchains` (please capture the screenshot after the compiler detection is completed).
I can't compile your code with clang or gcc:
Hope it is helpful.
Regards,
Rohit
The code provided in this comment doesn't compile with MSVC toolchain on my side:
And I checked several compilers on https://godbolt.org/ - the code doesn't compile.
Are you sure this exact code compiles on your side?
Please send the entire project to clion-support at jetbrains.com. And the idea.log file (Help | Show Log in ...) too. Note that logs might contain private user's information (like file paths and names).
My code compiles perfectly without strcmp().
Where do u want me to send my project?
Is it clion-support@jetbrains.com??
Regards,
Rohit R
>My code compiles perfectly without strcmp().
Without? Does it compile with strcmp()?
The provided project can't be built with any toolchain - the compilation error appears on the
put(strcmp(x,y))
line. It means that the code is incorrect and CLion indicated the error correctly.This forum is dedicated to CLion. And this issue is not CLion related.
You can ask questions about c++ programming, for example, on https://stackoverflow.com/.
Thank you for your help.
But I think that it is not my error as the function strcmp() is not working on your IDE.
It would be very nice of you if you could resolve this issue.
>the function strcmp() is not working on your IDE
The code you wrote doesn't compile anywhere which means it's not a valid C++ code. There is an error in your code and CLion correctly indicates that. In other words, CLion works correctly, there is no issue with CLion.
Correcting the user's code is out of scope of CLion support.