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.

Reply
  • > 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.

Children