Re: Compiler Errors





On Mon, Jul 16, 2012 at 8:55 PM, Santhosh Edukulla <santhosh edukulla gmail com> wrote:
Team,

We are using libxml++ and using below entries under Makefile.am as below:

If i dont include them, it throws tons of errors. As mentioned in
other mail to use pkg_config to g++ compiler directly works and  no
issues.

Question1: I wanted to know as how can i include pkg_config directly
under Makefile.am to avoid many includes below?

INCLUDES =   -I${includedir} -I${COMMON}/include ...
-I/usr/lib64/glibmm-2.4/include/ -I/usr/lib64/libxml++-2.6/include/

I would say, replace this by INCLUDES = `pkg_config --cflags --libs libxml++-2.6`
Of course, this could be coded neater.
The best way would be to have a configure script searching for pkg_config and make it
come up with a similar statement.
This is probably something you should to if you plan to make your software working in different environments.
Googling on Makefile, autoconf and automake should get you started with this I would guess.
 
Question2: Also, we have made a static library which is written using
libxml++ lib. Now, this static library is used by various modules. Do
they also had to refer to pkg-config in their makefile.am to get the
module working? currently, when i have written a test program
consuming this static library, it throws those errors and only when
executed with pkg-config cflags...etc to g++ compiler, it works.

This suggests that your static library does not have the libxml++ functions in it.
It should have been built with a static version of libxml++, but because these
functions were not added you are now required to link against the libraries to provide the functionality.
Perhaps at look at http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html might help.

Good Luck,
Hugo

 

Any thoughts?

Thanks in Advance!
Santhosh

On 5/16/12, Kjell Ahlstedt <kjell ahlstedt bredband net> wrote:
> 2012-05-16 16:00, Santhosh Edukulla skrev:
>> Hi All,
>>
>> I have installed libxml++ from below link:
>>
>> 1/ When i compile my code file using the command below (EX), It works fine
>> :
>>
>> g++  -g res_parser.cpp -o program `pkg-config --cflags --libs
>> libxml++-2.6`
>>
>> 2/ But, when i run like below. It gives tons of errors.
>> g++  -g res_parser.cpp -o program
>>
>> Few of the errors are below:
>>
>> /usr/include/libxml++/validators/dtdvalidator.h:24: error: expected
>> ‘,’ or ‘...’ before ‘::’ token
>> /usr/include/libxml++/validators/dtdvalidator.h:25: error: expected
>> ‘,’ or ‘...’ before ‘::’ token
>> /usr/include/libxml++/validators/dtdvalidator.h:25: error:
>> ‘xmlpp::DtdValidator::DtdValidator(int)’ cannot be overloaded
>> /usr/include/libxml++/validators/dtdvalidator.h:24: error: with
>> ‘xmlpp::DtdValidator::DtdValidator(int)’
>> /usr/include/libxml++/validators/dtdvalidator.h:28: error: expected
>> ‘,’ or ‘...’ before ‘::’ token
>> /usr/include/libxml++/validators/dtdvalidator.h:29: error: expected
>> ‘,’ or ‘...’ before ‘::’ token
>> /usr/include/libxml++/validators/dtdvalidator.h:30: error: expected
>> ‘,’ or ‘...’ before ‘::’ token
>>
>> Any idea as to why these errors are?
>>
>> Thanks in Advance!
>> Santhosh
>>
> These errors (at least the first few, I didn't check all of them) comes
> from lines where Glib::ustring is mentioned. Some of the libxml++ header
> files include <glibmm/ustring.h>, and without `pkg-config --cflags
> --libs libxml++-2.6` g++ can't find that file.
>
> What makes you think that you should be able to compile and link without
> `pkg-config --cflags --libs libxml++-2.6`? Is there any documentation
> that says so? In that case, it's wrong. Or what's the problem with
> including `pkg-config --cflags --libs libxml++-2.6` in the g++ command?
> You can store it in a makefile or a shell script. You don't have to
> write it every time you compile your program.
>
> Kjell
>
_______________________________________________
libxmlplusplus-list mailing list
libxmlplusplus-list gnome org
https://mail.gnome.org/mailman/listinfo/libxmlplusplus-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]