[ABANDONED] "Project items" for dummies question

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] "Project items" for dummies question

    I always find myself disliking IDEs project management, mainly because it's not transparent I think.

    I'm playing with the simple Hello World example in emStudio, and I am trying to add a linkable library (CException).

    1. I add a dynamic folder called CException, and point to where I have cloned CException.
    2. I exclude test in the dynamic folder configuration, because I have no interest of that
    3. I click on the newly added CException, and select Compile (works just fine)
    4. In my main.c I try to do #include "CException.h" but compile fails because "CException.h: No such file or directory"

    Do I really need to import the content of CException into my project in order for this to work??

    In short, I understand _nothing_ about how emStudio handles build dependencies and how to properly add libraries to a project and I can't find any documentation either that clearly explain how to do this...
  • Hi,

    Embedded Studio does not take the include directories from the project folders.

    Instead, as with most toolchains, you need to specify them in the project options.
    To do this, in the project options go to C/C++ -> Preprocessor and add CException, or the directory CException.h is located in, to the User Include Directories.

    Adding CException.h to your Embedded Studio project will do nothing but showing it there.

    To add a library, you can either have a solution with your application project and the library project and make the application dependent on the library, this way it will link the output of the library project,
    or you add the library file in the project options at Linker -> Additional Input Files if it is no dependency of the application project.

    In general Embedded Studio doesn't do any magic. If you want it to use a file, you need to add it to the appropriate options.

  • I'm not sure I'd agree with Johannes here about "most toolchains". Sure, this is true for most "build systems" (e.g., Make), but they are all painful to use.

    HolyDiver is asking for a little "magic", and it's a legitimate ask.

    CMake (which does support what HolyDiver is after via target_include_directories (issued on a library target), and target_link_libraries (issued on a lib or exe target to import what's needed from the dependency) is a generator of input files for various build systems. And a great many people use CMake as part of their C or C++ workflow since it tames project management complexity in a way that works much better than generating MAKEFILES or .emProject files manually.