[genivi-dlt] undefined reference to dlt_* when compiling Logging example from dlt_user_manual.txt

Prigent, Christophe christophe.prigent at intel.com
Tue May 30 08:12:17 EDT 2017

Good morning,

I have some compilation errors when I'm trying the logging example from https://github.com/GENIVI/dlt-daemon/blob/master/doc/dlt_user_manual.txt (section "=== Logging example").
How can I solve it?

Thank you,

#include <stdio.h>
#include <dlt/dlt.h>


int main()
   int num;

   DLT_REGISTER_APP("MYAP","My Application");
   DLT_REGISTER_CONTEXT(mycontext,"MYCT", "My Context");

   printf("Hello world");

   for(num=0;num<10;num++) {
      DLT_LOG(mycontext,DLT_LOG_INFO,DLT_STRING("Hello world"),DLT_INT(num));


   return 0;

christophe at XPS12-9Q33 ~/dev/logging-example $ gcc -o dltdemo -ldlt dltdemo.c
dltdemo.c:2:17: fatal error: dlt.h: No such file or directory
compilation terminated.
christophe at XPS12-9Q33 ~/dev/logging-example $ locate dlt.h

With #include <dlt/dlt.h> instead of #include <dlt.h>:

christophe at XPS12-9Q33 ~/dev/logging-example $ gcc -o dltdemo -ldlt dltdemo.c
/tmp/ccqfNZ9M.o: In function `main':
dltdemo.c:(.text+0x72): undefined reference to `dlt_check_library_version'
dltdemo.c:(.text+0x81): undefined reference to `dlt_register_app'
dltdemo.c:(.text+0x95): undefined reference to `dlt_register_context'
dltdemo.c:(.text+0xe0): undefined reference to `dlt_user_log_write_start'
dltdemo.c:(.text+0x103): undefined reference to `dlt_user_log_write_string'
dltdemo.c:(.text+0x11a): undefined reference to `dlt_user_log_write_int'
dltdemo.c:(.text+0x129): undefined reference to `dlt_user_log_write_finish'
dltdemo.c:(.text+0x151): undefined reference to `dlt_unregister_context'
dltdemo.c:(.text+0x156): undefined reference to `dlt_unregister_app'
collect2: error: ld returned 1 exit status
christophe at XPS12-9Q33 ~/dev/logging-example $

Distro: Linux Mint 18.1 Serena
Kernel: 4.4.0-53-generic x86_64 (64 bit gcc: 5.4.0)
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

More information about the genivi-diagnostic-log-and-trace mailing list