0

I'm making an application using glade 2 in ubuntu 18.04, I am coding with C, in this application I want to use a TWILIO SMS API, I've downloaded the code of the API following this link: https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-c here is my callbacks file which contains 1 button signal where I call my API function named twilio.c

    #ifdef HAVE_CONFIG_H
#  include <config.h>
#endif



#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include <gtk/gtk.h>
#include <math.h>
#include <cairo.h>
#include "twilio.h"


    void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
  char account_sid[100] = "ACXXXXXXXXXXXXXXXX" ;
  char auth_token[100] = "fxxxxxxxxxxxxxxxxx" ;
  char message[500] = "cher client , ....." ;
  char from_number[100] = "+000000000";
  char to_number[100]="+000000000" ;
  char picture_url[50] = "" ;
  bool verbose = FALSE ;



if ( twilio_send_message(account_sid,
                        auth_token,
                        message,
                        from_number,
                        to_number,
                        picture_url,
                        verbose)     ) 
printf("message envoyé") ;

}

the code of my fonction twilio is the same in the link . when i tap make it get this error :

twilio.o : In the function "twilio_send_message": /home/user/Bureau/graf/graf/src/twilio.c:53 : undefined reference to "curl_global_init"

and the same for all the functions in twilio.c any idea! I'm sure that I installed libcurl4 but I don't get the problem. thank you

IO23
  • 3
  • 2
  • If possible, please change your compiler's language to output error messages in English, so that you can post them in English. – Andreas Wenzel Dec 25 '20 at 01:22
  • Based on my limited French knowledge, I guess the error message translates to the following: `In the function "twilio_send_message": /home/user/Bureau/graf/graf/src/twilio.c:53 : undefined reference to "curl_global_init"` – Andreas Wenzel Dec 25 '20 at 01:24
  • Are you passing the libcurl library when calling the linker? – Andreas Wenzel Dec 25 '20 at 01:34
  • yes the he didn't Recognize all the functions related to curl how to pass it ? I compile with make , i tried to add the libcurl in the makefile but nothing works – IO23 Dec 25 '20 at 21:28
  • You should check the documentation of your compiler/linker on how to add a library to the linker. What compiler are you using? GCC? Clang? This might be relevant: [How to add library search path to Clang?](https://stackoverflow.com/questions/42997218/add-library-search-path-to-clang) However, this will only expand the search path, but you must still add the actual name of the library to the linker. – Andreas Wenzel Dec 27 '20 at 07:31
  • @AndreasWenzel im using gcc , sorry i'm still beginner in ubuntu's compiling , – IO23 Dec 28 '20 at 00:05
  • "I'm sure that I installed libcurl4" -- How did you install libcurl? Using a package manager? Or did you build it yourself from source? If you installed it using a package manager, I guess that the library is already in the search path of your compiler. In that case, all you must do is pass the name of the library to the linker. Probably all you must do is add the `-lcurl` option to the command line when calling the compiler, it will automatically forward that option to the linker. In order to pass this command-line option, you must probably edit your makefile accordingly. – Andreas Wenzel Dec 28 '20 at 10:05
  • thank you @AndreasWenzel , it was helpful – IO23 Dec 30 '20 at 01:17

0 Answers0