http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54775



             Bug #: 54775

           Summary: string error

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: zero...@gmail.com





I am using Eclipse, GCC 4.8 and building C++ project on both Mac OS 10.7 and

10.8. For the most of the time, the project builds and runs properly except for

some specific functions. For example:



int main( int argc, char ** argv ) {

    string a = "test";

    string b = "-bla";

    string c;

    c = a + b;

    return 0;

}

The compile is successful:



Build of configuration Debug for project Working **



make all Building file: ../working.cpp Invoking: GCC C++ Compiler g++ -O0 -g3

-Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"working.d" -MT"working.d"

-o "working.o" "../working.cpp" Finished building: ../working.cpp Building

target: Working Invoking: MacOS X C++ Linker g++ -o "Working" ./working.o

Finished building target: Working



Build Finished **



However, I received this runtime error:



dyld: lazy symbol binding failed: Symbol not found: __ZNSsaSEOSs

  Referenced from: /Volumes/Macintosh

HD/Users/zeroliu/Study/CPP/Working/Debug/Working

  Expected in: /usr/lib/libstdc++.6.dylib



dyld: Symbol not found: __ZNSsaSEOSs

  Referenced from: /Volumes/Macintosh

HD/Users/zeroliu/Study/CPP/Working/Debug/Working

  Expected in: /usr/lib/libstdc++.6.dylib

I find that the error comes from



string c;

c = a + b; 

The interesting thing is, if I make the following changes:



string c = a+b;

or



c = a;

The programs runs perfectly.

Reply via email to