Code:
#include <iostream>
using namespace std;
void read()
{
char i;
cout << "Should I rename?" << endl << "Y/n"<<endl ;
cin >> i;
cout << "Should I format HDD?" << endl << "Y/n"<<endl ;
cin >> i;
cout << "Formatting... press s and <enter> to stop" << endl;
cin >> i;
cout << "The end"<< endl;
}
int main()
{
read();
return 0;
}
#include <iostream>
using namespace std;
void read()
{
char i;
cout << "Should I rename?" << endl << "Y/n"<<endl ;
cin >> i;
cout << "Should I format HDD?" << endl << "Y/n"<<endl ;
cin >> i;
cout << "Formatting... press s and <enter> to stop" << endl;
cin >> i;
cout << "The end"<< endl;
}
int main()
{
read();
return 0;
}
Cisto da nesto radi. gcc u devcpp pod windozom mi ga iskompajlira bez problema, a pod linuxom imam
bash-2.05b$ cc '/home/vladab/Desktop/virus.cpp'
/tmp/ccrxv8Je.o(.text+0x11): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0x16): In function `read()':
: 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/ccrxv8Je.o(.text+0x1e): In function `read()':
: 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/ccrxv8Je.o(.text+0x26): In function `read()':
: 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/ccrxv8Je.o(.text+0x36): In function `read()':
: 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/ccrxv8Je.o(.text+0x3e): In function `read()':
: 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/ccrxv8Je.o(.text+0x46): In function `read()':
: 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/ccrxv8Je.o(.text+0x54): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0x59): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0x68): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0x6d): In function `read()':
: 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/ccrxv8Je.o(.text+0x75): In function `read()':
: 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/ccrxv8Je.o(.text+0x7d): In function `read()':
: 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/ccrxv8Je.o(.text+0x8d): In function `read()':
: 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/ccrxv8Je.o(.text+0x95): In function `read()':
: 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/ccrxv8Je.o(.text+0x9d): In function `read()':
: 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/ccrxv8Je.o(.text+0xab): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0xb0): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0xbf): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0xc4): In function `read()':
: 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/ccrxv8Je.o(.text+0xcc): In function `read()':
: 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/ccrxv8Je.o(.text+0xd4): In function `read()':
: 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/ccrxv8Je.o(.text+0xe2): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0xe7): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0xf6): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0xfb): In function `read()':
: 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/ccrxv8Je.o(.text+0x103): In function `read()':
: 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/ccrxv8Je.o(.text+0x10b): In function `read()':
: 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/ccrxv8Je.o(.text+0x14b): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccrxv8Je.o(.text+0x17c): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccrxv8Je.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
bash-2.05b$
u cemu je problem, tj sta fali. Da napomenem da sam instalirao programe iz source-a bez problema.
/tmp/ccrxv8Je.o(.text+0x11): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0x16): In function `read()':
: 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/ccrxv8Je.o(.text+0x1e): In function `read()':
: 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/ccrxv8Je.o(.text+0x26): In function `read()':
: 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/ccrxv8Je.o(.text+0x36): In function `read()':
: 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/ccrxv8Je.o(.text+0x3e): In function `read()':
: 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/ccrxv8Je.o(.text+0x46): In function `read()':
: 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/ccrxv8Je.o(.text+0x54): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0x59): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0x68): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0x6d): In function `read()':
: 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/ccrxv8Je.o(.text+0x75): In function `read()':
: 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/ccrxv8Je.o(.text+0x7d): In function `read()':
: 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/ccrxv8Je.o(.text+0x8d): In function `read()':
: 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/ccrxv8Je.o(.text+0x95): In function `read()':
: 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/ccrxv8Je.o(.text+0x9d): In function `read()':
: 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/ccrxv8Je.o(.text+0xab): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0xb0): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0xbf): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0xc4): In function `read()':
: 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/ccrxv8Je.o(.text+0xcc): In function `read()':
: 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/ccrxv8Je.o(.text+0xd4): In function `read()':
: 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/ccrxv8Je.o(.text+0xe2): In function `read()':
: undefined reference to `std::cin'
/tmp/ccrxv8Je.o(.text+0xe7): In function `read()':
: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)'
/tmp/ccrxv8Je.o(.text+0xf6): In function `read()':
: undefined reference to `std::cout'
/tmp/ccrxv8Je.o(.text+0xfb): In function `read()':
: 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/ccrxv8Je.o(.text+0x103): In function `read()':
: 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/ccrxv8Je.o(.text+0x10b): In function `read()':
: 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/ccrxv8Je.o(.text+0x14b): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccrxv8Je.o(.text+0x17c): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccrxv8Je.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
bash-2.05b$