How to deal with Makefile:44: recipe for target 'target' failed error when there are no errors in C Code in devloper studio?


#1

Let me elobarate my problem-

I wanted to get GPS co ordinates and I copied textLoc.c example the code works well without any modification but when I deleted SMS sending part and used a simple printf function to display the co ordinates acquired the the follwing error popr up every time I build the program

Makefile:44: recipe for target ‘target’ failed

I repeat the build fuction doesnt show any error in C code. Im stuck here can anyone help me with this ?

#include "legato.h"
/* IPC APIs */
#include "interfaces.h"
#include <stdio.h>
#define GPSTIMEOUT 15

static le_result_t GetCurrentLocation(
    int32_t *latitudePtr,           ///< [OUT] latitude of device - set to NULL if not needed
    int32_t *longitudePtr,          ///< [OUT] longitude of device - set to NULL if not needed
    int32_t *horizontalAccuracyPtr, ///< [OUT] horizontal accuracy of device - set to NULL if not
                                ///< needed
    uint32_t timeoutInSeconds       ///< [IN] duration to attempt to acquire location data before
                                ///< giving up.  A value of 0 means there is no timeout.
 )
 {
   le_posCtrl_ActivationRef_t posCtrlRef = le_posCtrl_Request();
   if (!posCtrlRef)
   {
      LE_ERROR("Can't activate the Positioning service");
      return LE_UNAVAILABLE;
    }

     le_result_t result;
    const time_t startTime = time(NULL);
    LE_INFO("Checking GPS position");
    while (true)
    {
       result = le_pos_Get2DLocation(latitudePtr, longitudePtr, horizontalAccuracyPtr);
       if (result == LE_OK)
       {
        break;
        }
    else if (
        (timeoutInSeconds != 0) &&
        (difftime(time(NULL), startTime) > (double)timeoutInSeconds))
        {
        result = LE_TIMEOUT;
        break;
       }
       else
       {
        // Sleep for one second before requesting the location again.
        sleep(1);
       }
      }

     le_posCtrl_Release(posCtrlRef);

     return result;
       }
     int main(void)
      {

       int32_t latitude;
       int32_t longitude;
       int32_t horizontalAccuracy;

        const le_result_t result =
       GetCurrentLocation(&latitude, &longitude, &horizontalAccuracy, GPSTIMEOUT * 60);
       if (result == LE_OK)
       {
        printf("Loc:%d,%d", latitude, longitude);
       }
        else
       {
         printf("Loc:unknown");
        }
         return 0;
        }

#2

Hi,

I would suggest posting your issue on the Legato forum (http://forum.legato.io) rather than here as there are more developers who are familiar with this sort of thing there than here.

Regards

Matt


#3

Hey @hitheshkaranth,

@mlw is correct in the sense that the Legato forum is a better fit for programming related questions.

Would you be able to post your Makefile (here or on GitHub gist) so I can have a look?

Cheers!


#4

Thanks for the reply @nvd and @mlw I will go through the forum.