main.cpp
#include <string>
#include <iostream>
using namespace std;
int main ( int argc, int argv[] )
{
cout << "running....\n";
cout<<"finished"<<endl;
return 0;
}
compile.sh
#compile
CFG=/usr/bin/mysql_config
sh -c "gcc -o mysqltest `$CFG --cflags` main.cpp `$CFG --libs`"
errors
abc@localhost:~/Projects/mysqltest> ./compile.sh
/tmp/ccpF755X.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccpF755X.o: In function `__tcf_0':
main.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccpF755X.o: In function `main':
main.cpp:(.text+0x81): undefined reference to `std::cout'
main.cpp:(.text+0x86): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
main.cpp:(.text+0x90): undefined reference to `std::cout'
main.cpp:(.text+0x95): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
main.cpp:(.text+0x9d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
main.cpp:(.text+0xa2): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccpF755X.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
/tmp/ccpF755X.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccpF755X.o: In function `__tcf_0':
main.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccpF755X.o: In function `main':
main.cpp:(.text+0x81): undefined reference to `std::cout'
main.cpp:(.text+0x86): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
main.cpp:(.text+0x90): undefined reference to `std::cout'
main.cpp:(.text+0x95): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
main.cpp:(.text+0x9d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
main.cpp:(.text+0xa2): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccpF755X.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
The problem is that I was compiling with gcc instead of g++
No comments:
Post a Comment