I verified the the Ubuntu package was uninstalled. I ran "find /usr/lib
-name libcxx\*" to make sure there were no left over libs installed. I
installed the cxxtools libs to /usr/local/lib from my build. I ensured the
ldconfig was ran (as root) so the libs would be found properly. Currently,
that version is GIT version 7f195300e07dfd82dc81a8835ea02e27435769bc which
was the version where this howto was checked in. I tried the latest and
greatest before that. I have attached the source file I am compiling and
the output from running the command you specified.
To throw another wrench in the works, I tested compiling it with the
clang++ compiler. I do this from time to time because of the better
readable logging it provides compared to gcc. It compiles without issue
under clang. The issue seems to be between GCC and CXXTOOLS somehow.
Sadly, I can'y use clang with the project I hope to use cxxtools with.
Sending files in too emails because I tripped up the message size limit on
the list.
On Fri, Aug 8, 2014 at 6:17 PM, Tommi Mäkitalo <[email protected]> wrote:
> Hi,
>
> it should be enough to run:
>
> g++ -I/usr/local/include -L/usr/local/lib -o jsonwrite -lcxxtools
> jsonwrite.cpp
>
> The linker error looks like you link against a wrong library. Please check
> if you have a libcxxtools.so in /usr/lib. If so I guess you have installed
> cxxtools from the repository and also installed the git version.
>
> The compiler then finds the cxxtools headers in /usr/local/include, which
> are the headers from the git version but the linker tries to link against
> /usr/lib/libcxxtools.so, which comes from the repo and have different
> symbols than the headers declare.
>
>
> Tommi
>
>
> Am 08.08.2014 16:04, schrieb Robert Goley:
>
> I am trying to compile the example from this howto. The jsonwrite.cpp
> fails with the following on Ubuntu 14.04.
>
> g++ -I/usr/local/include -L/usr/local/lib -o jsonwrite -lcxxtools
> -lcxxtools-bin -lcxxtools-http -lcxxtools-json -lcxxtools-unit
> -lcxxtools-xmlrpc -lcxxtools -lstdc++ -Xlinker --no-demangle jsonwrite.cpp
> g++: error: jsonwrite.cpp: No such file or directory
> rag@dell-dev-rag:/usr/local/lib$ cd /rdadev
> rag@dell-dev-rag:/rdadev$ g++ -I/usr/local/include -L/usr/local/lib -o
> jsonwrite -lcxxtools -lcxxtools-bin -lcxxtools-http -lcxxtools-json
> -lcxxtools-unit -lcxxtools-xmlrpc -lcxxtools -lstdc++ -Xlinker
> --no-demangle jsonwrite.cpp
> /tmp/cc880bOn.o: In function `_ZN8cxxtools10InitLocaleC2Ev':
> jsonwrite.cpp:(.text._ZN8cxxtools10InitLocaleC2Ev[_ZN8cxxtools10InitLocaleC5Ev]+0x25):
> undefined reference to `_ZNSt5ctypeIN8cxxtools4CharEEC1Em'
> jsonwrite.cpp:(.text._ZN8cxxtools10InitLocaleC2Ev[_ZN8cxxtools10InitLocaleC5Ev]+0x98):
> undefined reference to `_ZNSt8numpunctIN8cxxtools4CharEEC1Em'
> /tmp/cc880bOn.o: In function
> `_ZNSt6localeC1ISt5ctypeIN8cxxtools4CharEEEERKS_PT_':
> jsonwrite.cpp:(.text._ZNSt6localeC2ISt5ctypeIN8cxxtools4CharEEEERKS_PT_[_ZNSt6localeC5ISt5ctypeIN8cxxtools4CharEEEERKS_PT_]+0x4e):
> undefined reference to `_ZNSt5ctypeIN8cxxtools4CharEE2idE'
> /tmp/cc880bOn.o: In function
> `_ZNSt6localeC1ISt8numpunctIN8cxxtools4CharEEEERKS_PT_':
> jsonwrite.cpp:(.text._ZNSt6localeC2ISt8numpunctIN8cxxtools4CharEEEERKS_PT_[_ZNSt6localeC5ISt8numpunctIN8cxxtools4CharEEEERKS_PT_]+0x4e):
> undefined reference to `_ZNSt8numpunctIN8cxxtools4CharEE2idE'
> /tmp/cc880bOn.o: In function
> `_ZNKSt11__use_cacheISt16__numpunct_cacheIN8cxxtools4CharEEEclERKSt6locale':
> jsonwrite.cpp:(.text._ZNKSt11__use_cacheISt16__numpunct_cacheIN8cxxtools4CharEEEclERKSt6locale[_ZNKSt11__use_cacheISt16__numpunct_cacheIN8cxxtools4CharEEEclERKSt6locale]+0x14):
> undefined reference to `_ZNSt8numpunctIN8cxxtools4CharEE2idE'
> /tmp/cc880bOn.o: In function
> `_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale':
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x78):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE8groupingEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0xdf):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE8groupingEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x181):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE8truenameEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x22d):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE8truenameEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x248):
> undefined reference to
> `_ZNKSbIN8cxxtools4CharESt11char_traitsIS0_ESaIS0_EE4copyEPS0_mm'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x27c):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE9falsenameEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x322):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE9falsenameEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x33d):
> undefined reference to
> `_ZNKSbIN8cxxtools4CharESt11char_traitsIS0_ESaIS0_EE4copyEPS0_mm'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x36a):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE13decimal_pointEv'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x39c):
> undefined reference to `_ZNKSt8numpunctIN8cxxtools4CharEE13thousands_sepEv'
> /tmp/cc880bOn.o: In function
> `_ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale':
> jsonwrite.cpp:(.text._ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale]+0xd):
> undefined reference to `_ZNSt5ctypeIN8cxxtools4CharEE2idE'
> jsonwrite.cpp:(.text._ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale]+0x76):
> undefined reference to `_ZTISt5ctypeIN8cxxtools4CharEE'
> /tmp/cc880bOn.o: In function
> `_ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale':
> jsonwrite.cpp:(.text._ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale]+0xd):
> undefined reference to `_ZNSt8numpunctIN8cxxtools4CharEE2idE'
> jsonwrite.cpp:(.text._ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale]+0x76):
> undefined reference to `_ZTISt8numpunctIN8cxxtools4CharEE'
> collect2: error: ld returned 1 exit status
>
>
> I have looked at the libraries with nm and see
> the _ZNSt5ctypeIN8cxxtools4CharEEC1Em
> and _ZNSt8numpunctIN8cxxtools4CharEEC1Em functions existing in the llibrary
> as text type values so I know that are in the library I am trying to link
> against. I am kinda puzzled why it would say they can not be found...
> Below is the same error with demangling left on for readability. Anyone
> see what I am missing?
>
>
> g++ -I/usr/local/include -L/usr/local/lib -o jsonwrite -lcxxtools
> -lcxxtools-bin -lcxxtools-http -lcxxtools-json -lcxxtools-unit
> -lcxxtools-xmlrpc -lcxxtools -lstdc++ jsonwrite.cpp
> /tmp/cckHR6BG.o: In function `cxxtools::InitLocale::InitLocale()':
> jsonwrite.cpp:(.text._ZN8cxxtools10InitLocaleC2Ev[_ZN8cxxtools10InitLocaleC5Ev]+0x25):
> undefined reference to `std::ctype<cxxtools::Char>::ctype(unsigned long)'
> jsonwrite.cpp:(.text._ZN8cxxtools10InitLocaleC2Ev[_ZN8cxxtools10InitLocaleC5Ev]+0x98):
> undefined reference to `std::numpunct<cxxtools::Char>::numpunct(unsigned
> long)'
> /tmp/cckHR6BG.o: In function
> `std::locale::locale<std::ctype<cxxtools::Char> >(std::locale const&,
> std::ctype<cxxtools::Char>*)':
> jsonwrite.cpp:(.text._ZNSt6localeC2ISt5ctypeIN8cxxtools4CharEEEERKS_PT_[_ZNSt6localeC5ISt5ctypeIN8cxxtools4CharEEEERKS_PT_]+0x4e):
> undefined reference to `std::ctype<cxxtools::Char>::id'
> /tmp/cckHR6BG.o: In function
> `std::locale::locale<std::numpunct<cxxtools::Char> >(std::locale const&,
> std::numpunct<cxxtools::Char>*)':
> jsonwrite.cpp:(.text._ZNSt6localeC2ISt8numpunctIN8cxxtools4CharEEEERKS_PT_[_ZNSt6localeC5ISt8numpunctIN8cxxtools4CharEEEERKS_PT_]+0x4e):
> undefined reference to `std::numpunct<cxxtools::Char>::id'
> /tmp/cckHR6BG.o: In function
> `std::__use_cache<std::__numpunct_cache<cxxtools::Char>
> >::operator()(std::locale const&) const':
> jsonwrite.cpp:(.text._ZNKSt11__use_cacheISt16__numpunct_cacheIN8cxxtools4CharEEEclERKSt6locale[_ZNKSt11__use_cacheISt16__numpunct_cacheIN8cxxtools4CharEEEclERKSt6locale]+0x14):
> undefined reference to `std::numpunct<cxxtools::Char>::id'
> /tmp/cckHR6BG.o: In function
> `std::__numpunct_cache<cxxtools::Char>::_M_cache(std::locale const&)':
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x78):
> undefined reference to `std::numpunct<cxxtools::Char>::grouping() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0xdf):
> undefined reference to `std::numpunct<cxxtools::Char>::grouping() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x181):
> undefined reference to `std::numpunct<cxxtools::Char>::truename() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x22d):
> undefined reference to `std::numpunct<cxxtools::Char>::truename() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x248):
> undefined reference to `std::basic_string<cxxtools::Char,
> std::char_traits<cxxtools::Char>, std::allocator<cxxtools::Char>
> >::copy(cxxtools::Char*, unsigned long, unsigned long) const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x27c):
> undefined reference to `std::numpunct<cxxtools::Char>::falsename() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x322):
> undefined reference to `std::numpunct<cxxtools::Char>::falsename() const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x33d):
> undefined reference to `std::basic_string<cxxtools::Char,
> std::char_traits<cxxtools::Char>, std::allocator<cxxtools::Char>
> >::copy(cxxtools::Char*, unsigned long, unsigned long) const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x36a):
> undefined reference to `std::numpunct<cxxtools::Char>::decimal_point()
> const'
> jsonwrite.cpp:(.text._ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale[_ZNSt16__numpunct_cacheIN8cxxtools4CharEE8_M_cacheERKSt6locale]+0x39c):
> undefined reference to `std::numpunct<cxxtools::Char>::thousands_sep()
> const'
> /tmp/cckHR6BG.o: In function `std::ctype<cxxtools::Char> const&
> std::use_facet<std::ctype<cxxtools::Char> >(std::locale const&)':
> jsonwrite.cpp:(.text._ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale]+0xd):
> undefined reference to `std::ctype<cxxtools::Char>::id'
> jsonwrite.cpp:(.text._ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt5ctypeIN8cxxtools4CharEEERKT_RKSt6locale]+0x76):
> undefined reference to `typeinfo for std::ctype<cxxtools::Char>'
> /tmp/cckHR6BG.o: In function `std::numpunct<cxxtools::Char> const&
> std::use_facet<std::numpunct<cxxtools::Char> >(std::locale const&)':
> jsonwrite.cpp:(.text._ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale]+0xd):
> undefined reference to `std::numpunct<cxxtools::Char>::id'
> jsonwrite.cpp:(.text._ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale[_ZSt9use_facetISt8numpunctIN8cxxtools4CharEEERKT_RKSt6locale]+0x76):
> undefined reference to `typeinfo for std::numpunct<cxxtools::Char>'
> collect2: error: ld returned 1 exit status
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.http://p.sf.net/sfu/bds
>
>
>
> _______________________________________________
> Tntnet-general mailing
> [email protected]https://lists.sourceforge.net/lists/listinfo/tntnet-general
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>
>
#include <string>
#include <cctype>
#include <iostream>
#include <cxxtools/jsonserializer.h>
#include <cxxtools/serializationinfo.h>
struct Configuration
{
std::string encoding;
std::vector<std::string> plugIns;
struct
{
int length;
bool useSpace;
} indent;
};
//We now define a serialization operator like that:
void operator<<= (cxxtools::SerializationInfo& si, const Configuration& config)
{
si.addMember("encoding") <<= config.encoding;
si.addMember("plug-ins") <<= config.plugIns;
cxxtools::SerializationInfo& sii = si.addMember("indent");
sii.addMember("length") <<= config.indent.length;
sii.addMember("use_space") <<= config.indent.useSpace;
}
//And a deserialization operator:
void operator>>= (const cxxtools::SerializationInfo& si, Configuration& config)
{
si.getMember("encoding") >>= config.encoding;
si.getMember("plug-ins") >>= config.plugIns;
const cxxtools::SerializationInfo& sii = si.getMember("indent");
sii.getMember("length") >>= config.indent.length;
sii.getMember("use_space") >>= config.indent.useSpace;
}
//Now we are ready to convert a C++ structure of that type into json. Lets try it out using this little program:
int main(int argc, char* argv[])
{
try
{
// create a configuration object:
Configuration config;
config.encoding = "UTF-8";
config.plugIns.push_back("python");
config.plugIns.push_back("c++");
config.plugIns.push_back("ruby");
config.indent.length = 3;
config.indent.useSpace = true;
// serialize to json
cxxtools::JsonSerializer serializer(std::cout);
serializer.beautify(true); // this makes it just nice to read
serializer.serialize(config).finish();
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
------------------------------------------------------------------------------
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general