C++ errors while compiling

I believe you’re trying to compile main.cpp with gcc instead of g++.

#include <string>
#include <stdio.h>
int main()
{
    std::string bla;
    bla = "BLA BLA";
    printf("%s\n",bla.c_str());
    return 0;
}

If you build the above code snippet with gcc you get the errors you mention.
If you use g++ it build ok, this makes sense since g++ will make sure all the proper stuff it put together when build C++.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)