Code Monkey home page Code Monkey logo

Comments (17)

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

See this discussion:

https://discuss.codechef.com/questions/87478/to_string-function-in-codeblock-not-wrorking

Chances are:

  • You have not set the proper C++11 compiler flags
  • You set the right compiler flags, but your Codeblocks version does not support C++11

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

Thank you i seriously forgot to set the Flag 🤦‍♂️

But i got another issue. I Included everything and also linked every library. Why do i get the Error

undefined reference to `BinaCPP::init(std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)'|

I can't seem to understand it :/

EDIT: I didn't want to start a new issue here :D

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

Did you compile binacpp as a separate library and link that to your own program? Or did you try to compile your program along with all of the binacpp sources?

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

tried to compile binacpp seperatly and still getting that ambigous error
image

Any idea?

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

I'm guessing it has something to do with spotty support for to_string on MinGW's side. You can try implementing this patch for now (found here):

#include <string>
#include <sstream>

namespace patch
{
    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }
}

#include <iostream>

int main()
{
    std::cout << patch::to_string(1234) << '\n' << patch::to_string(1234.56) << '\n' ;
}

You will have to add the patch:: namespace to all the calls that fail to make sure your modified version is called. Or do a search and replace in Codeblocks to replace all to_string calls to patch::to_string.

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

Thanks :D

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

No does not work. On Stack overflow i was told to reopen the issue.

I still cannot compile the Library for my system because apparently the using namespace std statement is causing the ambigous problem. any idea?

when running make in terminal i get following errormessages in terminal:

pi@raspberrypi:~/Desktop/patch/src $ make g++ -I../lib/libcurl-7.56.0/include -I../lib/jsoncpp-1.8.3/include -c binacpp.cpp -fPIC -o ../lib/libbinacpp/lib/binacpp.o binacpp.cpp: In static member function ‘static void BinaCPP::send_order(const char*, const char*, const char*, const char*, double, double, const char*, double, double, long int, Json::Value&)’: binacpp.cpp:909:39: error: call of overloaded ‘to_string(double&)’ is ambiguous post_data.append( to_string( quantity) ); ^ In file included from binacpp.cpp:16:0: binacpp_utils.h:28:15: note: candidate: std::__cxx11::string to_string(const T&) [with T = double; std::__cxx11::string = std::__cxx11::basic_string<char>] inline string to_string (const T& t) ^~~~~~~~~ binacpp_utils.h:36:20: note: candidate: std::__cxx11::string to_string(double) static std::string to_string(double val) ^~~~~~~~~ In file included from /usr/include/c++/6/string:52:0, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from binacpp.h:19, from binacpp.cpp:14: /usr/include/c++/6/bits/basic_string.h:5522:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long double) to_string(long double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5513:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(double) to_string(double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5504:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(float) to_string(float __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5498:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long unsigned int) to_string(unsigned long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5492:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long int) to_string(long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5486:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long unsigned int) to_string(unsigned long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5481:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long int) to_string(long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5475:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(unsigned int) to_string(unsigned __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5470:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(int) to_string(int __val) ^~~~~~~~~ binacpp.cpp:912:36: error: call of overloaded ‘to_string(double&)’ is ambiguous post_data.append( to_string( price) ); ^ In file included from binacpp.cpp:16:0: binacpp_utils.h:28:15: note: candidate: std::__cxx11::string to_string(const T&) [with T = double; std::__cxx11::string = std::__cxx11::basic_string<char>] inline string to_string (const T& t) ^~~~~~~~~ binacpp_utils.h:36:20: note: candidate: std::__cxx11::string to_string(double) static std::string to_string(double val) ^~~~~~~~~ In file included from /usr/include/c++/6/string:52:0, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from binacpp.h:19, from binacpp.cpp:14: /usr/include/c++/6/bits/basic_string.h:5522:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long double) to_string(long double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5513:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(double) to_string(double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5504:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(float) to_string(float __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5498:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long unsigned int) to_string(unsigned long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5492:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long int) to_string(long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5486:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long unsigned int) to_string(unsigned long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5481:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long int) to_string(long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5475:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(unsigned int) to_string(unsigned __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5470:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(int) to_string(int __val) ^~~~~~~~~ binacpp.cpp:921:42: error: call of overloaded ‘to_string(double&)’ is ambiguous post_data.append( to_string( stopPrice ) ); ^ In file included from binacpp.cpp:16:0: binacpp_utils.h:28:15: note: candidate: std::__cxx11::string to_string(const T&) [with T = double; std::__cxx11::string = std::__cxx11::basic_string<char>] inline string to_string (const T& t) ^~~~~~~~~ binacpp_utils.h:36:20: note: candidate: std::__cxx11::string to_string(double) static std::string to_string(double val) ^~~~~~~~~ In file included from /usr/include/c++/6/string:52:0, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from binacpp.h:19, from binacpp.cpp:14: /usr/include/c++/6/bits/basic_string.h:5522:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long double) to_string(long double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5513:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(double) to_string(double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5504:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(float) to_string(float __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5498:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long unsigned int) to_string(unsigned long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5492:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long int) to_string(long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5486:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long unsigned int) to_string(unsigned long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5481:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long int) to_string(long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5475:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(unsigned int) to_string(unsigned __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5470:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(int) to_string(int __val) ^~~~~~~~~ binacpp.cpp:926:43: error: call of overloaded ‘to_string(double&)’ is ambiguous post_data.append( to_string( icebergQty ) ); ^ In file included from binacpp.cpp:16:0: binacpp_utils.h:28:15: note: candidate: std::__cxx11::string to_string(const T&) [with T = double; std::__cxx11::string = std::__cxx11::basic_string<char>] inline string to_string (const T& t) ^~~~~~~~~ binacpp_utils.h:36:20: note: candidate: std::__cxx11::string to_string(double) static std::string to_string(double val) ^~~~~~~~~ In file included from /usr/include/c++/6/string:52:0, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from binacpp.h:19, from binacpp.cpp:14: /usr/include/c++/6/bits/basic_string.h:5522:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long double) to_string(long double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5513:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(double) to_string(double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5504:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(float) to_string(float __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5498:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long unsigned int) to_string(unsigned long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5492:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long int) to_string(long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5486:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long unsigned int) to_string(unsigned long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5481:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long int) to_string(long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5475:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(unsigned int) to_string(unsigned __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5470:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(int) to_string(int __val) ^~~~~~~~~ binacpp.cpp: In static member function ‘static void BinaCPP::withdraw(const char*, const char*, const char*, double, const char*, long int, Json::Value&)’: binacpp.cpp:1384:38: error: call of overloaded ‘to_string(double&)’ is ambiguous post_data.append( to_string( amount )); ^ In file included from binacpp.cpp:16:0: binacpp_utils.h:28:15: note: candidate: std::__cxx11::string to_string(const T&) [with T = double; std::__cxx11::string = std::__cxx11::basic_string<char>] inline string to_string (const T& t) ^~~~~~~~~ binacpp_utils.h:36:20: note: candidate: std::__cxx11::string to_string(double) static std::string to_string(double val) ^~~~~~~~~ In file included from /usr/include/c++/6/string:52:0, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from binacpp.h:19, from binacpp.cpp:14: /usr/include/c++/6/bits/basic_string.h:5522:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long double) to_string(long double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5513:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(double) to_string(double __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5504:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(float) to_string(float __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5498:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long unsigned int) to_string(unsigned long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5492:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long long int) to_string(long long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5486:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long unsigned int) to_string(unsigned long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5481:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(long int) to_string(long __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5475:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(unsigned int) to_string(unsigned __val) ^~~~~~~~~ /usr/include/c++/6/bits/basic_string.h:5470:3: note: candidate: std::__cxx11::string std::__cxx11::to_string(int) to_string(int __val) ^~~~~~~~~ Makefile:38: recipe for target '../lib/libbinacpp/lib/binacpp.o' failed make: *** [../lib/libbinacpp/lib/binacpp.o] Error 1

Any ideas?

Also i am using rasbian on a raspberry pi and Code::blocks IDE

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

You are right. The most recent few commits from @tensaix2j are causing these problems, the project no longer compiles on my machine as well. Most likely 2c03cb2 is the culprit.

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

I am running on a standard x86_64 OSX platform.

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

Looks like @tensaix2j was trying to use the same hack I mentioned above. This is caused by the addition of another to_string function in binacpp_utils.h. Because the new to_string is not in a namespace, and using namespace std is being used, we get this error. I added the std:: prefix to all usages of to_string in binacpp.cpp to avoid using the hack version and it compiled fine.

from binacpp.

pndiaye avatar pndiaye commented on August 16, 2024

I confirm, prepending std:: to all the calls to to_string does the work, at least on OSX.

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

when i type std::to_string() no suggestion pops up will it work ?

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

I now changed everything to std::to_string

Going to console and running make clean and make

Now i get a lot of notes saying parameter passing for argument of type ... will chanfe in GCC 7.1 and at the end failing compilation of libbinacpp.so

Any ideas? i'm pretty deperate rn

from binacpp.

alexanderkoumis avatar alexanderkoumis commented on August 16, 2024

That’s not an error is it? That looks like a warning. You need to show us the actual error message.

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

ah now i get it the actual problem is that it doesn't recognize the libcurl.so fileformat.

I guess its because i use rasbian for raspberry pi .

Any idea how i can compile libcurl for my raspberry ?

from binacpp.

pndiaye avatar pndiaye commented on August 16, 2024

This question doesn't belong in this thread but just for info:
You'll probably have to compile openssl (a dependency of libcurl), libcurl, jsoncpp and libwebsockets.
You can clone them from their github repo and can definitely find the compilation instructions for your platform there or on other threads more specific to them

from binacpp.

AlconDivino avatar AlconDivino commented on August 16, 2024

So i got another issue but i think this will be too much fpor this thread so i'll open another one

Thank you guys

from binacpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.