From: A. Murat EREN (meren@comu.edu.tr)
Date: Tue 22 Apr 2003 - 09:55:42 EEST
Merhabalar,
Hayatimin bir kac saatinin cok üzüntülü gecmesine neden olan bir hatayi sizle paylasmak ve akil danismak istiyorum. Mailin sonuna bir kaynak kod yapistiricam, o kodu,
[meren@sesua net]$ g++ -g -o net net.cpp
ile derledigimde sorunsuz sekilde derleniyor ve binary dosya olusturuluyor. fakat,
[meren@sesua net]$ gcc -g -o net net.cpp
/tmp/ccoGn6yl.o(.text+0x513): In function `main':
/home/meren/net/net.cpp:19: `operator new(unsigned)'ye tanımsız başvuru
/tmp/ccoGn6yl.o(.text+0x526):/home/meren/net/net.cpp:20: `operator new(unsigned)'ye tanımsız başvuru
/tmp/ccoGn6yl.o(.text+0x592):/home/meren/net/net.cpp:29: `operator new(unsigned)'ye tanımsız başvuru
/tmp/ccoGn6yl.o(.text+0x668):/home/meren/net/net.cpp:39: `operator delete(void*)'ye tanımsız başvuru
/tmp/ccoGn6yl.o(.eh_frame+0x11): In function `__init_()':
/home/meren/net/f_imps.cpp:15: `__gxx_personality_v0'ye tanımsız başvuru
collect2: ld çıkış durumu 1 ile döndü
gcc boyle bir linker hatasi veriyor.. bu paylasimli kütüphaneler ile ilgili bir sorun degil mi? fakat bir gün önce ayni kodu defalarca derlemistim gcc ile (c yerine c++ derleyicisi kullanmamin sebebi ise bellek yönetiminde new ve delete den yararlanabilmek).
Kaynak Kod'da su sekilde:
//
//net.cpp
//
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include"f_imps.cpp"
int main(int argc, char **argv)
{
Net_Int_Data * _data[DEF_MAX];
short first=1;
struct timespec *req,*rem;
req=new timespec;
rem=new timespec;
req->tv_sec=1;
req->tv_nsec=rem->tv_sec=rem->tv_nsec=0;
for(;;)
{
__init_();
for(c=0;c<DNr;c++)
{
_data[c]=new Net_Int_Data;
__ReVal_(_data,c);
if(first)
__StACal_F(_data,c);
else
{
__StACal_(_data,c);
printf("%s->\t in: %.2f out: %.2f\n",_data[c]->device_name,_data[c]->im_da_i,_data[c]->im_da_o);
}
}
for(c=0;c<DNr;c++)delete _data[c];
nanosleep(req,rem);
printf("########################################\n");
first=0;
}
return 0;
}
//
//EOF
//
Simdiden tesekkürler..
A. Murat EREN
meren@comu.edu.tr
http://wolf.comu.edu.tr/~evreniz/