Skip to content

to_string was not declared in this scope #5

Description

@ktnrs55

I got following error.

~/git/memdb/pintools$ ./build.sh 
make: Nothing to be done for `all'.
make objects
make[1]: Entering directory `/home/foo/git/memdb/pintools'
make[1]: Nothing to be done for `objects'.
make[1]: Leaving directory `/home/foo/git/memdb/pintools'
make libs
make[1]: Entering directory `/home/foo/git/memdb/pintools'
make[1]: Nothing to be done for `libs'.
make[1]: Leaving directory `/home/foo/git/memdb/pintools'
make dlls
make[1]: Entering directory `/home/foo/git/memdb/pintools'
make[1]: Nothing to be done for `dlls'.
make[1]: Leaving directory `/home/foo/git/memdb/pintools'
make apps
make[1]: Entering directory `/home/foo/git/memdb/pintools'
make[1]: Nothing to be done for `apps'.
make[1]: Leaving directory `/home/foo/git/memdb/pintools'
make tools
make[1]: Entering directory `/home/foo/git/memdb/pintools'
g++ -Wall -Werror -Wno-unknown-pragmas -D__PIN__=1 -DPIN_CRT=1 -fno-stack-protector -fno-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-rtti -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_LINUX -fabi-version=2  -I/home/foo/pin/source/include/pin -I/home/foo/pin/source/include/pin/gen -isystem /home/foo/pin/extras/stlport/include -isystem /home/foo/pin/extras/libstdc++/include -isystem /home/foo/pin/extras/crt/include -isystem /home/foo/pin/extras/crt/include/arch-x86_64 -isystem /home/foo/pin/extras/crt/include/kernel/uapi -isystem /home/foo/pin/extras/crt/include/kernel/uapi/asm-x86 -I/home/foo/pin/extras/components/include -I/home/foo/pin/extras/xed-intel64/include/xed -I/home/foo/pin/source/tools/InstLib -O3 -fomit-frame-pointer -fno-strict-aliasing  -std=c++0x -g -Wno-error=format-contains-nul -Wno-format-contains-nul -Wno-write-strings  -c -o obj-intel64/memtracker.o memtracker.cpp
memtracker.cpp: In function ‘VOID recordMemoryAccess(ADDRINT, UINT32, ADDRINT, VOID*, VOID*)’:
memtracker.cpp:1160:46: error: ‘to_string’ was not declared in this scope
      source = filename + ":" + to_string(line);
                                              ^
make[1]: *** [obj-intel64/memtracker.o] Error 1
make[1]: Leaving directory `/home/foo/git/memdb/pintools'
make: *** [all] Error 2

Change from to_string to std::tostring doesn't help.
But code below is working.

#include <iostream>   // std::cout
#include <string>     // std::string, std::to_string

int main ()
{
  std::string pi = "pi is " + std::to_string(3.1415926);
  std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
  std::cout << pi << '\n';
  std::cout << perfect << '\n';
  return 0;
}

Compile with

g++ asdf.cpp -std=c++0x

-std=c++0x option might be overwrited? But where??

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions