This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How do you add a new file to Segger ?

I am pulling my hair, literally , I just can't get this company ! I am working with 4 IDE's in parallel and none of them has this stupidity .

  1. I right click->add a new file-> C file
  2. same for .h file
  3. In the project main.c file I try to include them : #include "source.h"

"No such file or directory" // he can't find the files that I see right in front of my face

So you have to add them to preprocessor some how right ? So I have a custom folder in my project with my files, how I force Segger to see the whole folder so I can keep adding source files and he can see them?

What are the exact steps to be able to add files to the project ? 4 hours of searching , this is insane.

WHY THEY DID THIS SO HARD ????????????????

Parents Reply Children
  • Well I know that but I don't understand what is going on . I created a folder inside the project inspector and added source files in it. How do you add the path to this folder ? this folder is not exist in your computer its just in the project inspector . How you add that folder to your preprocessor? it has no path! If I made a folder inside the project called "bla" what is the path of it ? if you check your project folder in the mac you will not find "bla" anywhere, only the source files.

  • So when you just add files in the project inspector, the file will be located in the project folder itself(where the project .emProject file is located). So add $(ProjectDir) to the User Include Directories

  • That worked. I wonder where you learn all these things, there is NOWHERE on the internet information about it, specifically this line you just show me here. I can't understand why I am the only one who struggles with this thing.

  • Sometimes you cannot find the answer to your exact problem on the internet. So you have to find the solution yourself using logic and resonating, and you get better at that with more experience. If you still can't find the solution, you ask on Devzone :). Here is the logic I used to find the answer:

    1. I tested what you did with creating the files with the project inspector, and I see that the files that are created is located in the project folder itself. When I get the error "No such file or directory"", I know that the compiler does not know the location of the files.
    2. Where does the Segger compiler look for the file location ? => in the "User Include Directories". That means that the project folder itself is not located in the "User Include Directories". In the "User Include Directories" there is a option to "Show Macros". I found the $(ProjectDir) there. :)
  • @Daniel Wang Thanks, your logic is not so fair, first because I said on the question that I did try to add it to the project path, and the full path did NOT work. Second, and most important, I think it has to do with understanding humans, when you understand them, you find it hard to understand why some companies makes things really un-logic. If you make a software, and a user adds a file, you KNOW he wants to use it, and if you know it, you automatically add it for him, this is how it works in EVERY IDE out there. EVERY . So when you understand UI, UX, you can't even believe you have to add files yourself, you think you did something wrong. And if a company like Segger who has probably millions of dollars can't actually understand such basic things, so that makes them old, stupid, and unrelevant for the future. The fact that people accept this just makes them strange, not me.

Related