--=-UxTidu79pV7/+pndGGsT Content-Type: multipart/alternative; boundary="=-hBro3+Unp5t+dvHbgTo4" --=-hBro3+Unp5t+dvHbgTo4 Content-Type: text/plain Content-Transfer-Encoding: 7bit Somebody please explain what I'm doing wrong here. I'm trying to work on some of my Advanced Placement computer science AB projects here at home. Well, I typed in the code, checked it twice and ran 'gcc main.cpp' to no avail. First it gave me warnings about textspace standard so I fixed the code to make it recent (the book is 1994) and tried again. I now get all kinds of linker errors: /tmp/ccv7OZu3.o: In function `main': /tmp/ccv7OZu3.o(.text+0x36): undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' /tmp/ccv7OZu3.o(.text+0x43): undefined reference to `std::cout' /tmp/ccv7OZu3.o(.text+0x48): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' /tmp/ccv7OZu3.o(.text+0x51): undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))' /tmp/ccv7OZu3.o(.text+0x86): undefined reference to `std::cout' /tmp/ccv7OZu3.o(.text+0x8b): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, std::_Setw)' /tmp/ccv7OZu3.o(.text+0x94): undefined reference to `std::basic_ostream >::operator<<(int)' /tmp/ccv7OZu3.o(.text+0x10b): undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' /tmp/ccv7OZu3.o(.text+0x118): undefined reference to `std::cout' /tmp/ccv7OZu3.o(.text+0x11d): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' /tmp/ccv7OZu3.o(.text+0x126): undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))' /tmp/ccv7OZu3.o(.text+0x15b): undefined reference to `std::cout' /tmp/ccv7OZu3.o(.text+0x160): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, std::_Setw)' /tmp/ccv7OZu3.o(.text+0x169): undefined reference to `std::basic_ostream >::operator<<(int)' /tmp/ccv7OZu3.o(.text+0x17b): undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' /tmp/ccv7OZu3.o(.text+0x180): undefined reference to `std::cout' /tmp/ccv7OZu3.o(.text+0x185): undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))' /tmp/ccv7OZu3.o: In function `__static_initialization_and_destruction_0(int, int)': /tmp/ccv7OZu3.o(.text+0x1b6): undefined reference to `std::ios_base::Init::Init[in-charge]()' /tmp/ccv7OZu3.o: In function `__tcf_0': /tmp/ccv7OZu3.o(.text+0x1e5): undefined reference to `std::ios_base::Init::~Init [in-charge]()' /tmp/ccv7OZu3.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status Does anyone know what I can do about this? -- Zach Schimke --=-hBro3+Unp5t+dvHbgTo4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Somebody please explain what I'm doing wrong here. I'm trying to work on some of my Advanced Placement computer science AB projects here at home. Well, I typed in the code, checked it twice and ran 'gcc main.cpp' to no avail. First it gave me warnings about textspace standard so I fixed the code to make it recent (the book is 1994) and tried again. I now get all kinds of linker errors:

/tmp/ccv7OZu3.o: In function `main':
/tmp/ccv7OZu3.o(.text+0x36): 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> >&)'
/tmp/ccv7OZu3.o(.text+0x43): undefined reference to `std::cout'
/tmp/ccv7OZu3.o(.text+0x48): 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*)'
/tmp/ccv7OZu3.o(.text+0x51): 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/ccv7OZu3.o(.text+0x86): undefined reference to `std::cout'
/tmp/ccv7OZu3.o(.text+0x8b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::_Setw)'
/tmp/ccv7OZu3.o(.text+0x94): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
/tmp/ccv7OZu3.o(.text+0x10b): 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> >&)'
/tmp/ccv7OZu3.o(.text+0x118): undefined reference to `std::cout'
/tmp/ccv7OZu3.o(.text+0x11d): 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*)'
/tmp/ccv7OZu3.o(.text+0x126): 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/ccv7OZu3.o(.text+0x15b): undefined reference to `std::cout'
/tmp/ccv7OZu3.o(.text+0x160): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::_Setw)'
/tmp/ccv7OZu3.o(.text+0x169): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
/tmp/ccv7OZu3.o(.text+0x17b): 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> >&)'
/tmp/ccv7OZu3.o(.text+0x180): undefined reference to `std::cout'
/tmp/ccv7OZu3.o(.text+0x185): 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/ccv7OZu3.o: In function `__static_initialization_and_destruction_0(int, int)':
/tmp/ccv7OZu3.o(.text+0x1b6): undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccv7OZu3.o: In function `__tcf_0':
/tmp/ccv7OZu3.o(.text+0x1e5): undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccv7OZu3.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Does anyone know what I can do about this?


-- Zach Schimke
--=-hBro3+Unp5t+dvHbgTo4-- --=-UxTidu79pV7/+pndGGsT Content-Disposition: attachment; filename=main.cpp Content-Type: text/x-c++; name=main.cpp; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit // main.cpp // // This program sorts an array's values into ascending order. #include #include using namespace std; int main(){ const int arraySize = 10; int a[arraySize] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37}; int hold; int j=0; cout << "Data items in original order" << endl; for (int i = 0; i < arraySize; i++) cout << setw(4) << a[i]; for (int pass = 1; pass < arraySize - 1; pass++) for (int i = 0; i < arraySize - pass; i++) if (a[i] > a[i + 1]) { hold = a[i]; a[i] = a[i + 1]; a[i + 1] = hold; } cout << "Data items in ascending order" << endl; for (int i = 0; i < arraySize; i++) cout << setw(4) << a[i]; cout << endl; return 0; } --=-UxTidu79pV7/+pndGGsT--