#33 Include for Linker

open
5
2012-07-07
2009-07-20
Nora
No

For a library i'm using (v-usb), it requires the user to define a .h file that it then uses. Thus, it would be nice to have an include path option
for the linker, just like the compiler. Otherwise, I have to find the directory of my project and add to the extra flag area. Isn't that hard, but just wishing

Discussion

  • In general, isn't a incude path option for the linker pointless as headers are integrated at compile time, not at linking time?
    But it goes in the same direction as what I asked Thomas about a year ago for.
    I have some kind of libraries that cannot be precompiled like a usual lib because defines like ports or ids differ from µC to µC. In addition, for example, these µC may have different clock rates so a F_CPU in the library project is useless.
    I figured a way to get such a behaviour with simple projects, still working, you just have to get the trick.
    Thomas had the idea of several build configs for the lib, like Release_MC1, Release_MC2 and so on which is intricate and moves the config from the main project to several lib projects, which is imo not that nice.
    Would be grateful for a nice solution, too!
    JFK

     
  • OK, you're probably right, the situation is a little different I realize. Basically, the compilation is separated into different components. The .o files are produced, then the elf, etc. In the .o file compilation for my code, the includes from compilation are included. However, once it gets to the elf files, the include paths aren't included. I've found that by doing the above, it solves the problem. Perhaps, the solution is simply to include those include paths in the elf compilation too?

     
  • LOL, on the other hand I think I know why. The files i am linking to actually have .c file extensions and .S. Thus, when the linker tries to link, it must first compile the files to .o files. Since these files need the user defined usbconfig.h, one must include an include path.

     
  • reassigning to current maintainer