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 list
[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

Reply via email to