Undefined Reference to 'mkfifo'

  • frankly
  • Beginner
  • Beginner
  • frankly
  • Posts: 52

Post 3+ Months Ago

I am using FIFO to make a pipe for files and don't know why the compiler pops out error message saying
Code: [ Select ]
undefined reference to 'mkfifio'

my line is like this
Code: [ Select ]
status = mkfifo(filename, S_IWUSR | S_IRUSR );

So....anyone knows what's wrong with it?
Thanz!! :D
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Sounds like a linking issue, make sure when you compile your script you are passing are passing all the right options. I have never heard of mkfifio, but that undefined referenece usually is caused by the linker I believe.
  • frankly
  • Beginner
  • Beginner
  • frankly
  • Posts: 52

Post 3+ Months Ago

o yes I mistakenly say it as a compile error, it is a linker error indeed. Haha u got it right. cool!!

Well I do think I am pazsing the right parameters. So do u know how to fix linking problems? I am using the DEV C++ compiler. I heard someone saying add the library into the linker or sth....don't know much...so any idea?

Thanz!! :D
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Try adding this after the '#include <sys/stat.h>' statement

Code: [ Select ]
int mkfifo(const char *s, mode_t m) {
  return 0;
}
  1. int mkfifo(const char *s, mode_t m) {
  2.   return 0;
  3. }
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

If that does not work I found this from google:

"Now for the Tcl changes. The first change is needed because mkfifo is not supported under Cygwin. Here is the linker error I get when trying to build expect with Cygwin gcc.

Code: [ Select ]
gcc -g -O2 -mno-win32 -DCYGWIN_ALTTCL -o expect.exe exp_main_exp.o libexpect526.a ../tcl/cygwin/libtcl_cygwin.a  -luser32
../tcl/cygwin/libtcl_cygwin.a(tclUnixFCmd.o)(.text+0x3be): undefined reference to `mkfifo'
collect2: ld returned 1 exit status
make: *** [expect.exe] Error 1
  1. gcc -g -O2 -mno-win32 -DCYGWIN_ALTTCL -o expect.exe exp_main_exp.o libexpect526.a ../tcl/cygwin/libtcl_cygwin.a  -luser32
  2. ../tcl/cygwin/libtcl_cygwin.a(tclUnixFCmd.o)(.text+0x3be): undefined reference to `mkfifo'
  3. collect2: ld returned 1 exit status
  4. make: *** [expect.exe] Error 1


I really could not find an answer here, but just clarification that the problem may not be how you are doing things, but a bug in your compiler/linker. You might also make sure you are using hte latest version of your compiler/linker, which might solve the problem if the resolution I stated above did not work.
  • frankly
  • Beginner
  • Beginner
  • frankly
  • Posts: 52

Post 3+ Months Ago

I think ur first suggestion actually works!! haha
but not sure...have to gie more tests on it first
And for the google paragraph that u found, what does it mean by "the first change is needed"? what exactly is the "first change"? :shock:

Thanz!! :D
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I don't know, I just copied and pasted that. I don't think the first change refers to anything relevant though, it had to do with some program that wasn't working, and I think the first change was to fix the mkfifo problem.
  • frankly
  • Beginner
  • Beginner
  • frankly
  • Posts: 52

Post 3+ Months Ago

o..it's ok anywayz I'm still testing the program coz I think the lines that u told me to add r simply a function declaration right? I wonder if it really does what its supposed to do........ :shock:
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Yeah its just declaring it because your compiler doesnt have it defined. From what I read I think it will still function right though, you should test it out and see.

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 45 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.