I have a folder components in my project which has another folder fico in which there is a file I want to use le_helper_stub_local.h (components -> fico -> file I want to use). Then I have another folder positioning which has two folders: platform and posDaemon. I am working with a file inside posDaemon and I want to include in this file le_helper_stub_local.h.
I used the following:
#include "../../ficoStub/le_helper_stub_local.h"
but when I compile I have an error of undefined reference to the functions I am using from inside le_helper_stub_local.h What am I doing wrong? sorry if it sounds like a beginner question but I don´t really use C.
the code for le_helper_stub_local.h:
#ifndef LEGATO_STUB_LOCAL_INCLUDE_GUARD
#define LEGATO_STUB_LOCAL_INCLUDE_GUARD
#include "legato.h"
FILE * Stub_openStream(char *pathIn);
void Stub_writeHeader(FILE* fp, char *functionName);
void Stub_writeParam (FILE* fp, int nParam, char *paramName, char*
paramContent);
void Stub_writeTail(FILE* fp);
bool Stub_lookForCall(FILE* fp, int *remains);
void Stub_updateRemains(FILE *fp, int remains);
le_result_t le_helper_stub_Init
(
void
);
#endif // LEGATO_STUB_LOCAL_INCLUDE_GUARD
this is a part of the code where I´ve included the above file: le_result_t le_gnss_GetDate ( le_gnss_SampleRef_t positionSampleRef, ///< [IN] ///< Position sample's reference.
uint16_t* yearPtr,
///< [OUT]
///< UTC Year A.D. [e.g. 2014].
uint16_t* monthPtr,
///< [OUT]
///< UTC Month into the year [range 1...12].
uint16_t* dayPtr
///< [OUT]
///< UTC Days into the month [range 1...31].
)
{
le_result_t result = LE_FAULT;
// 1. Open the output file and add/save information related to the execution.
char pathOut[] = "/stub/positioning_le_gnss_GetDate.out";
char functionName[] = "le_gnss_GetDate";
FILE * fp = Stub_openStream(pathOut);
Stub_writeHeader(fp, functionName);
Stub_writeTail(fp);
result = le_atomFile_CloseStream(fp);
return result;
for compiling I have a script which compiles my entire project which is python and C. It´s too long to write it here. This is the error I get during complilation:
posDaemon.so: undefined reference to Stub_writeHeader'
build/qemuarm/system/component/6c05f6c53a95e6505773ec507f339d0a/obj/libComponent_posDaemon.so: undefined reference to
Stub_writeTail'
build/qemuarm/system/component/6c05f6c53a95e6505773ec507f339d0a/obj/libComponent_posDaemon.so: undefined reference to `Stub_openStream'
collect2: error: ld returned 1 exit status
[390/601] Linking C executable
I´ve used the le_helper_stub_local.h before in other files but I´ve never had this problem before. I also don´t think now that it´s an inclusion problem.