[Help-gnutls] Re: Compiling and linking problems
Simon Josefsson
jas at extundo.com
Fri Dec 30 19:46:40 CET 2005
zero_effect at mail.bg writes:
> So I have written my first application with GnuTLS, but when
> I decided to compile it, there appears some errors that I
> can't correct. The application is closely based on the SRP
> client example and is written in C++.
>
> When I use the GnuTLS 1.3.x branch the compiler gives me the
> following error:
>> # g++ -o client client.cxx
>> In file included from common.h:4
>> from client.cxx:32
>> /usr/include/gnutls/extra.h:95: error: expected `,' or
> `...' before "new"
> It doesn't appear when I make my application C compatible
> and compile it with gcc C compiler. Maybe the cause of the
> error is that in C++ there is a operator named "new", but
> in the header file "new" is used as a pointer.
Are you sure your code doesn't contain syntactic bugs?
Hm. Perhaps C++ doesn't like variables called 'new'? It is used in
this prototype:
typedef int (*gnutls_ia_avp_func) (gnutls_session_t session, void *ptr,
const char *last, size_t lastlen,
char **new, size_t * newlen);
Try renaming 'new' to 'next' and see if it builds. If it works, I'll
change it.
> The second error appears while the linking (no matter which
> version I use - 1.2.x or 1.3.x):
>> # gcc -o client client.cxx `libgnutls-config --libs
> --cflags`
>> /tmp/ccWTsMl2.o(.text+0x12f): In function `main':
>> : undefined reference to `gnutls_global_init_extra'
>> collect2: ld return 1 exit status
If you are using libgnutls-extra, you should use
`libgnutls-extra-config --libs --cflags' instead.
More information about the Gnutls-help
mailing list