Refactor: renaming file name results in renaming my class name
Hello,
I have a problem/difficulty using refactor-> rename. I would very appreciate if someone could help with that!
I have a class MyCar implemented in the file named MyCar.cpp (Note that there is no MyCar.h)
I want to rename the file MyCar.cpp to my_car.cpp and I did it using Refactor -> Rename ( or using Shift+F6). It works BUT CLion also renamed the name of the class inside that file: the class MyCar became my_car, which I don't want and CLion is supposed not doing that.
Could you please help how to fix this?
The same thing also happens for the header file. For example, I have a header file MyBike.h, and a class MyBike inside that header file. Then Shif+F6 to rename the file MyBike.h also results in renaming the class name inside.
Here is the screen shoot:
- Project before refactor-> rename


- Project after renaming:

请先登录再写评论。
Hi! Thanks a lot for the detailed description.
We have the related issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-2724. Feel free to comment or upvote, follow it to get updates.
Hi, thanks for the comment. But this is a new/ different problem comparing with the one in your link.
Use CMakeLists.txt like this:
project(my_project)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})