Build with object files without sources

Hi,
i try to build some "libraries" having only the .h and .o files.
I add the .h in the IDE and the .o in the project settings builder in the section C/C++ Build → Settings → Tool Settings → C Linker → Miscellaneous → Other objects.
But when i build i got error in linker operations "undefined reference to 'mycustomFunction'.

I do this operation with other eclipse enviroment and i'havent any problem.

I'm missing something??

Thanks
S.

Parents
  • Hello, Ste Stu Sig.

    Which toolchain and which e² studio version you use?
    Is it C project or C++ project?

  • Its a C project i'm using e2studio 2021-01 with GCC ARM Embedded 9.2.1.20191025

  • > i try to build some "libraries" having only the .h and .o files.
    In order to create a library (*.a) file, you should generate "Library project", not "C project".
    You could change Build Artifact type from executable to "Static Library"  (find "Build Artifact" tab in project property) when once generated as C project.
    In Library project, no need to add *.o but need to add source files to be compiled.

    You may have to check source location configuration if source files were not compiled.
    cf. FAQ - Source files placed out of /src folder are not compiled
    https://en-support.renesas.com/knowledgeBase/16979430

    > I add the .h in the IDE and the .o in the project settings builder in the section C/C++ Build → Settings → Tool Settings → C Linker → Miscellaneous → Other objects.
    > But when i build i got error in linker operations "undefined reference to 'mycustomFunction'.
    Described function names can be wrong or mangled if it is C++ function or called from C++ source files.

  • For me

    C/C++ Build → Settings → Tool Settings → C Linker → Miscellaneous → Other objects

    don't add the object in the makefile, or is simply ignored by the e2studio.

    Can you try it?

  • > C/C++ Build → Settings → Tool Settings → C Linker → Miscellaneous → Other objects
    > don't add the object in the makefile, or is simply ignored by the e2studio.

    It works for me.
    The user added object will be listed in "objects.mk".
    The object file name (in full path) will appear in build console during linking.

    Since the error is not "file not found", linker option may have no problem.

  • Ok, i found the problem. If i use the "File System" to add the files the build work. If i use the "Workspace" build fails, this is strange becouse when the project is build, in the "objects.mk" the files are added using absolute path, so i don't really understand why with the "Workspace" this don't work.

Reply
  • Ok, i found the problem. If i use the "File System" to add the files the build work. If i use the "Workspace" build fails, this is strange becouse when the project is build, in the "objects.mk" the files are added using absolute path, so i don't really understand why with the "Workspace" this don't work.

Children