tux-world
چهارشنبه 08 مرداد 1393, 23:37 عصر
سلام دوستان. من بعد مدتها به سمت سی برگشتم تا بعد از یاد گرفتش برم سمت کیوت. مشکلم اینه که آموزشهایی که هستن تو لینوکس نمیتونم کدها رو کامپایل کنم به هدر و تابع main گیر میده. انگار تفاوتهایی بین ایناست که من نتونستم رفرنس مناسبی پیدا کنم. ممنون میشم راهنمایی کنید
#include <iostream>
using namespace std;
int main()
{
std::cout<< "salam";
return 1;
}
خطا:
tux-world@alachiq:~ > gcc test.cpp
/tmp/ccdqoTMG.o: In function `main':
test.cpp:(.text+0x14): undefined reference to `std::cout'
test.cpp:(.text+0x19): 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/ccdqoTMG.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x41): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x58): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
#include <iostream>
using namespace std;
int main()
{
std::cout<< "salam";
return 1;
}
خطا:
tux-world@alachiq:~ > gcc test.cpp
/tmp/ccdqoTMG.o: In function `main':
test.cpp:(.text+0x14): undefined reference to `std::cout'
test.cpp:(.text+0x19): 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/ccdqoTMG.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x41): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x58): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status