Search code examples
eclipseeclipse-cdt

What would cause my source files to be greyed out with a strikethrough through the file icon?


I'm trying to build an application for the STM32F4 Discovery board using Eclipse Mars. In particular I'd like to use the SPI library. I've included the corresponding header file in my main program but am getting the error that the function I'm trying to use is undefined.

HAL_SPI_Init is undeclared

A little bit of poking and I realize that most of the source files for the project are greyed out with a bar struck through the icon.

Greyed out Source files.

Most I could find was people talking about how entire folders were greyed out. I've tried looking for 'greyed out icon', 'strike through', and any combination of grey, icon and bar but to no avail. Does anyone know it means if a file is greyed out and struck through?


Solution

  • The greyed/striked out file means the file is excluded from the build.

    To exclude/include, right click on the file and choose Resource Configurations --> *Exclude from build...".

    You should be presented with a GUI like this:

    exclude

    and you should be able to update which build configurations are excluded.

    .cproject (edit/view the xml)

    If you have a lot of edits to make, sometime you may find it useful to view or even edit the .cproject xml file. For example here are some exclusions as listed in my .cproject

    <sourceEntries>
        <entry excluding="final.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="othersrc"/>
        <entry excluding="dir1/third.c|other.c|hello.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
    </sourceEntries>