Eragon0605
December 5th, 2009, 02:22 AM
I have been programming in C++ for about a year now, but it was always under Window$. Today was my first time programming under Ubuntu, and I have run into a serious error. When I try to compile a C++ program with strings in it, I get the messages:
/home/dck/strings.o In function 'main':
strings.cpp:(.text+0xe7) undefined reference to '__sync_fetch_and_add_4'
=== Build finished: 1 errors, 0 warnings ===
Here is the code:
#include <string>
#include <iostream>
using namespace std;
int main()
{
string a("Bob the Samurai is Awesome!!!");
cout << a << endl;
return 0;
}I can compile any program that doesn't use strings no problem. I have looked at several tutorials, and I can't see any difference between my code and their code... I am using the Code::Blocks IDE.
/home/dck/strings.o In function 'main':
strings.cpp:(.text+0xe7) undefined reference to '__sync_fetch_and_add_4'
=== Build finished: 1 errors, 0 warnings ===
Here is the code:
#include <string>
#include <iostream>
using namespace std;
int main()
{
string a("Bob the Samurai is Awesome!!!");
cout << a << endl;
return 0;
}I can compile any program that doesn't use strings no problem. I have looked at several tutorials, and I can't see any difference between my code and their code... I am using the Code::Blocks IDE.