STM32CubeIDE: How to update Includes Folder in Project Explorer - stm32cubeide

I have a question about how to update Includes folder in a downloaded example from STM32 CubeMX.
Currently, I am working with LoRaWAN_End_Node example downloaded from STM32 CubeMX for the board Nucleo-WL55JC1. Based on that example, I want to add some of my files (both header and source files).
I want to ask how do I update Includes folder (in Project Explore) when I put new header files in the Inc directory (Inc is not shown in the Project Explorer tab).
I hope to have help from people in the community.
Thank you, Huy Nguyen.

It's been a while since you asked, but I hope it may help someone
First, I think that you need to build the solution in orded to the files to be added
What I usually do to add header (and source files) is to create a new folder, I add that folder path into the project (project properties -> C/C++ General -> Paths and symbols -> includes -> add), inside that folder I add the Inc and Src folders (Add them inside the STM32CubeIDE), and add those as source Locations (project properties -> C/C++ General -> Paths and symbols -> Source Locations -> add folder)
Then copy the headers and source files that you might need (whit the windows explorer), finally build the project, when you build it the files will be added to the project.

Related

.class file opens instead of .java while debugging

Current setup:
MainProject which is a Library Project
BranchProject which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
Skyler's answer from this post worked for me:
Opening source code from debug view edits .class after Android R18 update
Here is a summary:
The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
When you're using a Library project one of the things you're in fact doing is compiling your Library project into a jar and then referencing that jar in your calling Project.
If you right click the Project, and select "Configure Build Path" you'll see a tab called "Libraries", if you look inside "Android Dependencies" you'll notice a list of jar's corresponding to your Library projects.
These jars are expandable, showing you that they have a slot for a source attachment. Usually this would be editable allowing you to directly link the source but in terms of ADT these are already filled and are uneditable.
When debugging these files you're linked to a read-only class file with this attached source. This is because you're not running against source files directly, you're running against a pre-compiled class file. Until the ADT team get this functionality in place, you're pretty much forced to jump to the direct source code and rebuild everything.
EDIT
See #Steven linked answer :)
I faced the same issue while debugging the a .java file using Eclipse IDE. As per my understanding this issue comes when we put the xyz.class file of xyz.java file or JAR at the project build path. Delete the .class or JAR file from the project class path and rerun .java file in the debug mode. This time you see a source not found window. Click on "Source not found" button and check "Find duplicates..." at the bottom of the window. Done your problem is solved :)
The problem is that the class file is preferred over the java (by default), here is how you can change that for Eclipse (tested on NEON 2):
Right-click on the Project in the Project-Explorer, click Properties
On the new window select: Run/Debug Settings
Create a new configuration (or duplicate another one)
Select the new config and click Edit...
Go to the tab Source
Select the Default and Remove
Create a new path with Add..., select Java Library, then JRE System Library
Create a new path with Add..., select the location where the sourcecode is by Workspace folder (if it is a project in the same workspace) or File System directory (it it is not)
I think this depends on, how you set up the dependency in eclipse. You should set up your BranchProject to depend on the source-Files of your MainProject. If you depend on compiles Class-Files is obvious that the debugger opens the class files, because it does not know about the source files.
I found a good solution for me here:
Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
Simply, select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
If you tried all above hints and it still doesn't work try this solution, it worked form me:
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path...
Select tab Order and Export
select library that you can't reach code and then click on button Bottom
Then click on Apply and Close
hope this can help you
Most of the time it happens when specific source folder are not added in build path Sources tab.
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path -> Source Tab
Add the source folder if your project source folder is not there.
Select Add folder -> select your project source folder specifically. Eg: project_name/src . Then Apply it and restart server.

How to place a file on classpath in Eclipse?

As this documentation says, "For example if you place this jndi.properties file on your classpath", but how can I place the .properties file on my classpath if I am using Eclipse?
Just to add. If you right-click on an eclipse project and select Properties, select the Java Build Path link on the left. Then select the Source Tab. You'll see a list of all the java source folders. You can even add your own. By default the {project}/src folder is the classpath folder.
One option is to place your properties file in the src/ directory of your project. This will copy it to the "classes" (along with your .class files) at build time. I often do this for web projects.
This might not be the most useful answer, more of an addendum, but the above answer (from greenkode) confused me for all of 10 seconds.
"Add Folder" only lets you see folders that are the sub-folders of the project whose build path you are looking at.
The "Link Source" button in the above image would be called "Add External Folder" in an ideal world.
I had to make a properties file that is to be shared between multiple projects, and by keeping the properties file in an external folder, I am able to have only one, instead of having a copy in each project.
Well one of the option is to goto your workspace, your project folder, then bin copy and paste the log4j properites file.
it would be better to paste the file also in source folder.
Now you may want to know from where to get this file, download smslib, then extract it, then smslib->misc->log4j sample configuration -> log4j here you go.
This what helped,me so just wanted to know.
Copy the file into your src folder. Go to the Project Explorer in Eclipse, Right-click on your project, and click on "Refresh". The file should appear on the Project Explorer pane as well.

Getting XCode to include, compile and link existing (C++) codebase in XCode 4.3(.1)

I'm trying to 'import' my existing C++ codebase into my XCode iOS project.
Problem is, xCode won't compile (and therefore not link) my code.
This is what I've done so far:
File > Add files to "Project". I don't tick 'Copy files' since it's a shared codebase for multiple platforms and multiple copies of source code is not an option.
I've added appropriate path to the "Header Search Path" project settings. Including header files works, I can #include "stuff.h" from my Objective-C++ (.mm) file.
However, I can't find any way of actually telling XCode to compile the .cpp files?
A few points:
I'm not looking for a way to pre compile it into a library and linking that way
The project is a standard iOS Objective-C project. The C++ code is called from it (that's not a problem)
Update
I've added the codebase directory to the target's "Compile Sources". I actually have to click "Add other..." in the dialog that pops up, since I can't select the directory reference to my codebase.
When I add it, XCode asks me if I want to "Create external build system project". I leave it ticked and the two fields with the default values "/usr/bin/make" and "$(ACTION)". However, my codebase doesn't get compiled during the build. Do I have to write my own Makefile ?
If I don't select "Create external build system project" then a directory reference is created under the target, but not compiled during the build and a warning is emitted:
warning: no rule to process file '$(PROJECT_DIR)/../codebase'
of type folder for architecture i386
Even if you don't check Copy Files you have to check Add to Targets when adding the files to the project.
If you forgot to do that, you can select the target, go to the Build Phases tab and add the files to Compile Sources.
If you go to your Targets -> Build Phases -> Compile Sources -> "+" -> "Add Others" -> (select your external source folder) -> Select: Create Group for any added folders -> Unchecked: Copy items into destination.
Now your folder will be in XCode, mimic the structure. If you add source files to that folder in XCode the source files will be added to your external source directory just fine. So the ease of using multiple IDEs and having to manage source linkage is solved.
The catch. You still have to manually add files into the "Compile Sources" area. This is rather simple. Just click and drag your source files from the group directory in XCode right into the Compile Sources window. So there is an extra step when you add a source file now. Forgetting to add them to the Compile Sources window will yield unresolved symbols compile errors.

Import existing src into root directory of Eclipse Project?

I am using Eclipse Indigo. I already have some code that is stored in a repository outside of my workplace directory. The repository contains various projects and so it wouldn't make sense to include it in the workspace. I have created an empty Java ME project and I now want to import various source files and folders by linking them in. I've played around with various settings, but Eclipse insists on creating a top level folder to hold them. To be clear, the hierarchy is:
Java ME Project -> Unwanted Top Level Folder -> Source Files and Folders
Can I make it instead:
Java ME Project -> Source Files and Folders
Update: Thanks Srikanth for the doc link. According to it, the file system should have a "Create selected folders only" option, but it isn't showing in my version (3.7.0.v20110530)
This feature does not seem to be available in Eclipse 3.7. In 3.6 (and maybe lower) it is possible though. While importing the existing src select Create selected folders only radio button.It will import only the wanted folders.

FDT / Eclipse : path variable

I am trying to create a script that would list all the linked libraries in an FDT project and their corresponding svn repositories.
My problem : I was not able to find the file on my system where Eclipse (or FDT, I'm not even sure) writes all of the path variables.
I have tried capturing changes on my system and have had no luck.
If anyone knows where to find this file (Mac OS X) or knows a technique I could use to find it, it would be very appreciated.
Thanks.
In FDT, you can find the list linked libraries in the .as3_classpath file if those libraries are in your project folder (or below). They reflect the content you add in the 'Library' tab of 'FDT Build Path' in your project's properties. There's also an entry in the .project file that reflect the linked libraries you add with the 'Source' tab. Those libraries can be located anywhere on your hard drive, and that's why you define 'path variables' for them.
Personally, I create a 'lib' folder in my project where I copy the libraries I need and add them with the 'Library' tab. I find it much easier to share the project (since everything is relative to the project) and you don't need to worry about having two projects modifying the same library file.
For the location of those 'Path' variables, as far as I know, could only be located in your eclipse installation folder or in your eclipse 'settings' folder, usually in your 'user' directory.