support for multiple source code files of the same filename

Comments

7 comments

  • Avatar
    Jon Elliott

    Hi Peter,

    One solution for this would be to use the Build Options > Intermediate Directory project property to make the object files go into a different directory - for example you could set this property to "laurel/$(ProjectName) $(Configuration)" on the laurel folder.

    Regards,

    Jon

    0
    Comment actions Permalink
  • Avatar
    Peter Lawrence

    Thanks, Jon.

    As a feature request, could there be some sort of "$()" macro with the folder name?  It seems like that might allow the Build Options > Intermediate Directory option to pick a distinct directory without manually setting one for each folder.

    0
    Comment actions Permalink
  • Avatar
    Kurt Bosmans

    I've run into this issue several times as well. It would be much nicer if the software supported this out of the box without any need for work arounds. These days any real project will use libraries from different sources and the chances of conflicting file names are ever increasing. The build should simply mimic the source tree and not put all object files in one directory.

    0
    Comment actions Permalink
  • Avatar
    Javier Box

    I second this. I'm having to set the intermediate and output directories by hand to avoid name conflicts and to extend and interface that is platform specific by having multiple source files.

     

    0
    Comment actions Permalink
  • Avatar
    Peter Lawrence

    Three years on, and this Crossworks quirk is still a nuisance. As Kurt said, it is a reality of today's code that multiple libraries might have the same source code file names. Surely, one of the suggested solutions above could have been adopted within Crossworks.

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    Hi Peter,

    It is not totally ideal, but CrossWorks now has the RelInputPath macro which you could use. For example, you could set the Code > Build > Intermediate Directory project property to $(ProjectName) $(Configuration)/$(RelInputPath)

    Note that this will only work for files that are in subdirectories of the project directory, it won't work for files that require an absolute path such as system files that haven't been imported into the project. So in your samenames project, this solution works if you set this property on the Source Files folder node.

    Regards,

    Jon

    0
    Comment actions Permalink
  • Avatar
    Peter Lawrence

    Thanks for the pointer to $(RelInputPath); it is an added tool to have in the toolbox (when used solely on source files in the project directory).

    At the risk of belaboring the point, though, I was going to attach another example project.  This has some extracted code from a library that I was attempting to compile in Crossworks the other day.  Alas, attachments are no longer permitted!?

    The example project demonstrates that Crossworks goes haywire when presented with two source files of the same name (in different directories).

    In the example, there are different numbers of error messages (sometimes hundreds of them) each time the code is built, but the vast majority are syntax errors on the intermediate asm file that Crossworks generates in its two-step compilation process.

    All of these errors swamp out the real issue and serve just as an unnecessary distraction to the user/programmer.

    That this same code existed and compiled in an IAR project without issue just throws salt on the wound.

    0
    Comment actions Permalink

Please sign in to leave a comment.