[lttng-dev] use of extern before tracepoint definition

Yonghong Yan yanyh15 at gmail.com
Mon Oct 7 12:06:10 EDT 2019


I am not sure whether this is a bug or the wrong I am using it. When I use
extern declaration as follows, I always have compilation error. I used the
easy-ust to demonstrate:

*diff --git a/doc/examples/easy-ust/sample_component_provider.h
b/doc/examples/easy-ust/sample_component_provider.h*

*index dd3c5f0..e70d650 100644*

*--- a/doc/examples/easy-ust/sample_component_provider.h*

*+++ b/doc/examples/easy-ust/sample_component_provider.h*

@@ -61,6 +61,8 @@

  */

 #include <lttng/tracepoint.h>



+extern int testint(int i);

+

 /*

  * The following tracepoint event writes a message (c string) into the

  * field message of the trace event message in the provider





*yanyh at vm*:*~/tools/lttng/lttng-ust/doc/examples/easy-ust*$ make

cc  -I.   \

-save-temps -c -o sample.o sample.c

cc  -I.   \

-save-temps -c -o tp.o tp.c

In file included from */usr/include/lttng/ust-tracepoint-event.h:974:0*,

                 from */usr/include/lttng/tracepoint-event.h:58*,

                 from *sample_component_provider.h:137*,

                 from *tp.c:33*:

*././sample_component_provider.h:64:1:* *error: *expected expression before
‘*extern*’

 extern int testint(int i);

* ^*

Makefile:34: recipe for target 'tp.o' failed

make: *** [tp.o] Error 1


Thank you

Yonghong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20191007/89cc99f6/attachment.html>


More information about the lttng-dev mailing list