2023-08-02 05:17 AM - edited 2023-08-02 05:19 AM
Hi,
I'm using the sample HID_Standalone (USB_Host) for the board NUCLEO-H723ZG. I tried to rename the file main.c into main.cpp to force compilation with g++ instead of gcc. This worked fine with an Hello World I studied before.
Unfortunately, a really weird behaviour appears. If I rename the file with right click -> rename, the file appears renamed on the IDE but the actual file on the filesystem stays main.c. If I open with right click->show in->system explorer it's still main.c. If I run the build project command it still looks for main.c. If I rename the file on the system explorer it says that file main.c is not found. If I rename subdir.mk in the core folder another one is generated and it still contains main.c.
How to rename correctly the file? Is this the expected behaviour?
2023-08-02 06:29 AM
Right click rename should be working. Works for me.
Could create a new file and copy over the contents and delete the old file. Convert the project to C++ so it looks for those sources.
2023-08-02 06:54 AM - edited 2023-08-02 06:55 AM
Hi TDK,
apparently the files on this example, as shown on the eclipse/Cube IDE, are links. if I right click->show in->properties I can see the various parameters associated. It appears that when you rename them, the original file is not renamed, (but the link is). As a workaround, I removed the link main.c from the left panel on Cube, renamed it on the system explorer and then dragged/dropped the renamed file on the folder back on the left panel of Cube. At that point a pop up menu opens with some options for the new link.
Once that was done, I converted the project to C++, and now trying to figure out some compilation errors that arise. Thanks for the help.
2023-08-02 06:57 AM - edited 2023-08-02 06:58 AM
This can be if main.c in the eclipse project is a "linked file". In this case the .project contains two different names, one shown in the project explorer tree and the real one. Example:
<linkedResources>
<link>
<name>Src/MAIN.CPP</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/Src/main.c</locationURI>
</link>
...............
</linkedResources>
Very intuitive, duh.
2023-08-07 10:38 AM
two different names, one shown in the project explorer tree and the real oneVery intuitive, duh.
It's a sarcasm... Is it?
2023-08-07 07:05 PM - edited 2023-08-07 07:06 PM
(Obviously always "very intuitive" :grinning_face_with_sweat:)