saugeorg / kosmosfs

Automatically exported from code.google.com/p/kosmosfs
Apache License 2.0
0 stars 0 forks source link

can't use seek() function #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
operation system: centos 6.2 64-bit

kfs version: kfs-0.5 

when I compile the KfsSample_main.cc file, it has same erros: 

make all 
Building file: ../kfstest.cpp
Invoking: GCC C++ Compiler
g++ -I/home/altair/code/kfs/include/kfs -O0 -g3 -Wall -c -fmessage-length=0 
-MMD -MP -MF"kfstest.d" -MT"kfstest.d" -o"kfstest.o" "../kfstest.cpp"
Finished building: ../kfstest.cpp

Building target: KfsTestSample
Invoking: GCC C++ Linker
g++  -o"KfsTestSample"  ./kfstest.o  
/home/altair/code/kfs/lib/static/libkfsClient.a 
/home/altair/code/kfs/lib/static/libkfsCommon.a 
/home/altair/code/kfs/lib/static/libkfsEmulator.a 
/home/altair/code/kfs/lib/static/libkfsIO.a 
/home/altair/code/kfs/lib/static/libkfsMeta.a 
/home/altair/code/kfs/lib/static/libqcdio.a 
/home/altair/code/kfs/lib/static/libtools.a -lpthread -lcrypto -lrt
./kfstest.o: In function `main':
/home/altair/workspace/KfsTestSample/Debug/../kfstest.cpp:193: undefined 
reference to `KFS::KfsClient::Seek(int, long)'
collect2: ld returned 1 exit status
make: *** [KfsTestSample] Error 1

the code that I use seek() is:
    gKfsClient->Seek(fd, (off_t)40);

the complier force (off_t)40 convert to long int;and can't find 
Seek(int,off_t) define.Has I done something wrong?Hope to get some help,thank!

Original issue reported on code.google.com by le...@126.com on 29 Jun 2012 at 6:16

GoogleCodeExporter commented 8 years ago
add to src:
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
or: modify the gcc option... 

please see the kfs-0.5/CMakeLists.txt
add_definitions (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -D_LARGE_FILES)

Original comment by hongyin...@gmail.com on 13 Aug 2012 at 9:38