* Re: linking C++ modules against lttng-ust libraries
[not found] <5370E082.2060104@keymile.com>
@ 2014-05-12 17:43 ` Jérémie Galarneau
[not found] ` <CA+jJMxtKdvH_Eu7OdQLuR_ekX1uqCM-fDo6ZSk6ZLXCJUHW-Tw@mail.gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Jérémie Galarneau @ 2014-05-12 17:43 UTC (permalink / raw)
To: Gerlando Falauto; +Cc: lttng-dev
On Mon, May 12, 2014 at 10:53 AM, Gerlando Falauto
<gerlando.falauto@keymile.com> wrote:
> Hi,
>
> I am trying to link a C++ application against lttng-ust, with a simple test
> case, and I get the following error message upon linking:
>
> main.cpp:109: undefined reference to `_lttng_ust_tracef(char const*, ...)'
>
> where main.cpp reads:
> ...
> 13: #include <lttng/tracef.h>
> ...
> 109: tracef("my message, this integer %d", 1234);
> ...
>
> The following seems to fix my problem:
>
> diff --git a/include/lttng/tracef.h b/include/lttng/tracef.h
> index 16a984b..98338d8 100644
> --- a/include/lttng/tracef.h
> +++ b/include/lttng/tracef.h
> @@ -23,6 +23,10 @@
> * SOFTWARE.
> */
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> #include <lttng/lttng-ust-tracef.h>
>
> extern
> @@ -35,4 +39,8 @@ void _lttng_ust_tracef(const char *fmt, ...);
> _lttng_ust_tracef(fmt, ## __VA_ARGS__); \
> } while (0)
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
> #endif /* _LTTNG_UST_TRACEF_H */
>
> But since I've noticed in the history that this whole C guard has been
> reworked several times lately, I have no idea whether this is a good idea or
> not.
> Don't know if this has any relevance or anything, but both lttng-ust (along
> with its dependencies) and my test application are being cross-compiled.
>
> Hints?
>
Indeed, that file seems to be missing guards. Your best bet would be
to submit a patch or open a bug against lttng-ust on bugs.lttng.org.
Thanks,
Jérémie
> Thank you,
> Gerlando
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: linking C++ modules against lttng-ust libraries
[not found] ` <CA+jJMxtKdvH_Eu7OdQLuR_ekX1uqCM-fDo6ZSk6ZLXCJUHW-Tw@mail.gmail.com>
@ 2014-05-13 13:35 ` Mathieu Desnoyers
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2014-05-13 13:35 UTC (permalink / raw)
To: Gerlando Falauto; +Cc: lttng-dev
----- Original Message -----
> From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
> To: "Gerlando Falauto" <gerlando.falauto@keymile.com>
> Cc: lttng-dev@lists.lttng.org
> Sent: Monday, May 12, 2014 1:43:06 PM
> Subject: Re: [lttng-dev] linking C++ modules against lttng-ust libraries
>
> On Mon, May 12, 2014 at 10:53 AM, Gerlando Falauto
> <gerlando.falauto@keymile.com> wrote:
> > Hi,
> >
> > I am trying to link a C++ application against lttng-ust, with a simple test
> > case, and I get the following error message upon linking:
> >
> > main.cpp:109: undefined reference to `_lttng_ust_tracef(char const*, ...)'
> >
> > where main.cpp reads:
> > ...
> > 13: #include <lttng/tracef.h>
> > ...
> > 109: tracef("my message, this integer %d", 1234);
> > ...
> >
> > The following seems to fix my problem:
> >
> > diff --git a/include/lttng/tracef.h b/include/lttng/tracef.h
> > index 16a984b..98338d8 100644
> > --- a/include/lttng/tracef.h
> > +++ b/include/lttng/tracef.h
> > @@ -23,6 +23,10 @@
> > * SOFTWARE.
> > */
> >
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > #include <lttng/lttng-ust-tracef.h>
> >
> > extern
> > @@ -35,4 +39,8 @@ void _lttng_ust_tracef(const char *fmt, ...);
> > _lttng_ust_tracef(fmt, ## __VA_ARGS__); \
> > } while (0)
> >
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
> > #endif /* _LTTNG_UST_TRACEF_H */
> >
> > But since I've noticed in the history that this whole C guard has been
> > reworked several times lately, I have no idea whether this is a good idea
> > or
> > not.
> > Don't know if this has any relevance or anything, but both lttng-ust (along
> > with its dependencies) and my test application are being cross-compiled.
> >
> > Hints?
> >
>
> Indeed, that file seems to be missing guards. Your best bet would be
> to submit a patch or open a bug against lttng-ust on bugs.lttng.org.
Fix pushed into master, please confirm that it fixes your issue:
commit 866f2767f671ffbbff2c0511964f5a9a66358184
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Tue May 13 09:34:03 2014 -0400
Fix: tracef.h: add missing c++ guard
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thanks,
Mathieu
>
> Thanks,
> Jérémie
>
> > Thank you,
> > Gerlando
> >
> > _______________________________________________
> > lttng-dev mailing list
> > lttng-dev@lists.lttng.org
> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
>
> --
> Jérémie Galarneau
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* linking C++ modules against lttng-ust libraries
@ 2014-05-12 14:53 Gerlando Falauto
0 siblings, 0 replies; 3+ messages in thread
From: Gerlando Falauto @ 2014-05-12 14:53 UTC (permalink / raw)
To: lttng-dev
Hi,
I am trying to link a C++ application against lttng-ust, with a simple
test case, and I get the following error message upon linking:
main.cpp:109: undefined reference to `_lttng_ust_tracef(char const*, ...)'
where main.cpp reads:
...
13: #include <lttng/tracef.h>
...
109: tracef("my message, this integer %d", 1234);
...
The following seems to fix my problem:
diff --git a/include/lttng/tracef.h b/include/lttng/tracef.h
index 16a984b..98338d8 100644
--- a/include/lttng/tracef.h
+++ b/include/lttng/tracef.h
@@ -23,6 +23,10 @@
* SOFTWARE.
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <lttng/lttng-ust-tracef.h>
extern
@@ -35,4 +39,8 @@ void _lttng_ust_tracef(const char *fmt, ...);
_lttng_ust_tracef(fmt, ## __VA_ARGS__); \
} while (0)
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _LTTNG_UST_TRACEF_H */
But since I've noticed in the history that this whole C guard has been
reworked several times lately, I have no idea whether this is a good
idea or not.
Don't know if this has any relevance or anything, but both lttng-ust
(along with its dependencies) and my test application are being
cross-compiled.
Hints?
Thank you,
Gerlando
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-13 13:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <5370E082.2060104@keymile.com>
2014-05-12 17:43 ` linking C++ modules against lttng-ust libraries Jérémie Galarneau
[not found] ` <CA+jJMxtKdvH_Eu7OdQLuR_ekX1uqCM-fDo6ZSk6ZLXCJUHW-Tw@mail.gmail.com>
2014-05-13 13:35 ` Mathieu Desnoyers
2014-05-12 14:53 Gerlando Falauto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.