Projects / libconfigduo / Comments

Comments for libconfigduo

15 Mar 2010 17:09 CristianCantoro

You ARE right! Extremely sorry about that!! I would better use `pkg-config --cflags --libs libconfig(++)` which works perfectly. Thank you

03 Mar 2010 18:27 mesmerism

CristianCantoro,

You are getting linker errors because you're missing the -l (lowercase L) switch to the linker. See the libconfig manual for details.

02 Mar 2010 09:01 CristianCantoro

Same issue with C library.

cristian@cristian-asus:~/Uni/Lab0809/Dati02/Elab/libconfig-1.4.3/examples/c$ gcc -Wall example1.c -o prova
/tmp/cce28C0R.o: In function `main':
example1.c:(.text+0x24): undefined reference to `config_init'
example1.c:(.text+0x38): undefined reference to `config_read_file'
example1.c:(.text+0x78): undefined reference to `config_destroy'
example1.c:(.text+0x9a): undefined reference to `config_lookup_string'
example1.c:(.text+0xf1): undefined reference to `config_lookup'
example1.c:(.text+0x10c): undefined reference to `config_setting_length'
example1.c:(.text+0x153): undefined reference to `config_setting_get_elem'
example1.c:(.text+0x16c): undefined reference to `config_setting_lookup_string'
example1.c:(.text+0x185): undefined reference to `config_setting_lookup_string'
example1.c:(.text+0x19e): undefined reference to `config_setting_lookup_float'
example1.c:(.text+0x1b7): undefined reference to `config_setting_lookup_int'
example1.c:(.text+0x21a): undefined reference to `config_lookup'
example1.c:(.text+0x235): undefined reference to `config_setting_length'
example1.c:(.text+0x27c): undefined reference to `config_setting_get_elem'
example1.c:(.text+0x295): undefined reference to `config_setting_lookup_string'
example1.c:(.text+0x2ae): undefined reference to `config_setting_lookup_string'
example1.c:(.text+0x2c7): undefined reference to `config_setting_lookup_float'
example1.c:(.text+0x2e0): undefined reference to `config_setting_lookup_int'
example1.c:(.text+0x33e): undefined reference to `config_destroy'
collect2: ld returned 1 exit status

Furthermore I don't understand why makefiles in the C and C++ examples directory use local copy (i.e. ../../lib) of the libraries to link. Is this right? Wouldn't be better to use /usr/local/include ?

02 Mar 2010 08:53 CristianCantoro

Same issue with libraries for me (64 bit arch - Ubuntu 10.04 Lucid Lynx ALPHA 2).

cristian@cristian-asus:~/libconfig-1.4.3/examples/c++$ g++ -Wall -I/usr/local/include -L/usr/local/lib example1.cpp -o prova
/tmp/cclCrcdi.o: In function `main':
example1.cpp:(.text+0x28): undefined reference to `libconfig::Config::Config()'
example1.cpp:(.text+0x3c): undefined reference to `libconfig::Config::readFile(char const*)'
example1.cpp:(.text+0x50): undefined reference to `libconfig::Config::lookup(char const*) const'
example1.cpp:(.text+0x65): undefined reference to `libconfig::Setting::operator std::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
example1.cpp:(.text+0x240): undefined reference to `libconfig::Config::getRoot() const'
example1.cpp:(.text+0x255): undefined reference to `libconfig::Setting::operator[](char const*) const'
example1.cpp:(.text+0x262): undefined reference to `libconfig::Setting::operator[](char const*) const'
example1.cpp:(.text+0x272): undefined reference to `libconfig::Setting::getLength() const'
example1.cpp:(.text+0x365): undefined reference to `libconfig::Setting::operator[](int) const'
example1.cpp:(.text+0x39f): undefined reference to `libconfig::Setting::lookupValue(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
example1.cpp:(.text+0x3be): undefined reference to `libconfig::Setting::lookupValue(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
example1.cpp:(.text+0x3dd): undefined reference to `libconfig::Setting::lookupValue(char const*, double&) const'
example1.cpp:(.text+0x3f9): undefined reference to `libconfig::Setting::lookupValue(char const*, int&) const'
example1.cpp:(.text+0x5dc): undefined reference to `libconfig::Setting::operator[](char const*) const'
example1.cpp:(.text+0x5e9): undefined reference to `libconfig::Setting::operator[](char const*) const'
example1.cpp:(.text+0x5f9): undefined reference to `libconfig::Setting::getLength() const'
example1.cpp:(.text+0x6ec): undefined reference to `libconfig::Setting::operator[](int) const'
example1.cpp:(.text+0x726): undefined reference to `libconfig::Setting::lookupValue(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
example1.cpp:(.text+0x745): undefined reference to `libconfig::Setting::lookupValue(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
example1.cpp:(.text+0x764): undefined reference to `libconfig::Setting::lookupValue(char const*, double&) const'
example1.cpp:(.text+0x780): undefined reference to `libconfig::Setting::lookupValue(char const*, int&) const'
example1.cpp:(.text+0x96c): undefined reference to `libconfig::Config::~Config()'
example1.cpp:(.text+0x989): undefined reference to `libconfig::Config::~Config()'
/tmp/cclCrcdi.o:(.gcc_except_table+0xa4): undefined reference to `typeinfo for libconfig::FileIOException'
/tmp/cclCrcdi.o:(.gcc_except_table+0xa8): undefined reference to `typeinfo for libconfig::ParseException'
/tmp/cclCrcdi.o:(.gcc_except_table+0xac): undefined reference to `typeinfo for libconfig::SettingNotFoundException'
collect2: ld returned 1 exit status

Please note that I receive the same message using libconfig installed using .deb or the site version (which is installed in /usr/local).

16 Feb 2010 21:41 mesmerism

Re: STL

You cannot copy Config objects. If you want to have an STL container of them, it has to be a container of Config pointers, not values.

16 Feb 2010 08:15 winsor

Hello! Thanks for correction @include!

There was other question. This library with STL is compatible?
simple code: (read_config_file - wrapper for try_catch only)

std::list <libconfig::Config> config_files;
libconfig::Config sf;
read_config_file("some_config",&sf);
config_files.push_back(sf);
in last line compiler generate error:
1>c:\program files\microsoft visual studio 9.0\vc\include\xmemory(52) : error C2248: 'libconfig::Config::Config' : cannot access private member declared in class 'libconfig::Config'
1> d:\old_infos\develop\dev_libs\include\libconfig.h++(358) : see declaration of 'libconfig::Config::Config'
1> d:\old_infos\develop\dev_libs\include\libconfig.h++(352) : see declaration of 'libconfig::Config'
1> c:\program files\microsoft visual studio 9.0\vc\include\xmemory(155) : see reference to function template instantiation 'void std::_Construct<libconfig::Config,_Ty>(_T1 *,const _T2 &)' being compiled
1> with
1> [
1> _Ty=libconfig::Config,
1> _T1=libconfig::Config,
1> _T2=libconfig::Config
1> ]

Thanks for comments!

09 Feb 2010 23:48 mesmerism

Re: Is there any know issue with X64 Architecture?

There shouldn't be...from your compiler errors it looks like you may be linking with the wrong libconfig (there are other projects named 'libconfig', unfortunately).

Re: support for relative paths in @include

I agree this is a good feature to have. Please submit a diff when you are done. Please make sure your change can deal with Windows path separators ('\') and can detect windows absolute paths (with drive letters).

Re: Please, specify "@include" directive usage....

This looks like a bug in the scanner. Whitespace before a @include directive should be ignored. I'll try to have a fix soon.

Re: small problem in libconfig.spec file

Thanks for the fix; I've incorporated your change.

09 Feb 2010 10:35 Sismon

Hi there,
I am using the library to compile a C program on an X64 Ubuntu, is there any know issue with X64 Architecture ?!?
By the way I am linking my program with "lconfig" and "lpq"(For Postgres), and it seems that it does not recognize the "lconfig" during the linking cause when I run:
gcc -lconfig -o ConfigServer ConfigServer.c -I/usr/include/postgresql/ -lpq

I got the following error :

/tmp/ccyqCsNA.o: In function `GetServiceStatus':
ConfigServer.c:(.text+0x371): undefined reference to `config_init'
ConfigServer.c:(.text+0x382): undefined reference to `config_read_file'
ConfigServer.c:(.text+0x3cb): undefined reference to `config_lookup'
ConfigServer.c:(.text+0x3de): undefined reference to `config_setting_get_string'
ConfigServer.c:(.text+0x3f6): undefined reference to `config_lookup'
ConfigServer.c:(.text+0x409): undefined reference to `config_setting_get_int'
ConfigServer.c:(.text+0x997): undefined reference to `config_destroy'
/tmp/ccyqCsNA.o: In function `main':
ConfigServer.c:(.text+0xeb5): undefined reference to `config_init'
ConfigServer.c:(.text+0xeda): undefined reference to `config_read_file'
ConfigServer.c:(.text+0xf04): undefined reference to `config_lookup'
ConfigServer.c:(.text+0xf17): undefined reference to `config_setting_get_string'
ConfigServer.c:(.text+0xf45): undefined reference to `config_lookup'
ConfigServer.c:(.text+0xf58): undefined reference to `config_setting_get_string'
ConfigServer.c:(.text+0xf94): undefined reference to `config_lookup'
ConfigServer.c:(.text+0xfa7): undefined reference to `config_setting_get_string'
ConfigServer.c:(.text+0x14d1): undefined reference to `config_destroy'
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libconfig.so: undefined reference to `mem_free_stub'
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libconfig.so: undefined reference to `log_printf_stub'
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libconfig.so: undefined reference to `mem_alloc_stub'
/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/libconfig.so: undefined reference to `mem_realloc_stub'
collect2: ld returned 1 exit status

Thanks for any comment, help !

06 Feb 2010 23:50 ice_cool

I have been working on changing the @include directives in 2 ways :
- support relative paths. At the moment, the path is based on the working directory of the executable, not the path of the "parent" config file.
- support environment variables in include paths.
I have a draft implementation of both of them, on v1.4.2.

04 Feb 2010 08:30 winsor

Hello!

Please, specify "@include" directive usage....
libconfig is 1.4.2
Example test files (simple parser generate error in line 4 - syntax error ):

1:configs=(
2: {
3: name="111";
4: \t\t\t\t@include "ats_1.cfg"
},
{
name="222";
@include "ats_2.cfg"
}
);
Modify line 4 (remove space and tabs chars before @include):

1:configs=(
2: {
3: name="111";
4:@include "ats_1.cfg"
},
parser no error generate. I cannot use formatting at the directive "@include"?

Thanks for advice.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.