pipe functions
Posted: Sat Aug 17, 2013 9:59 am
Hello,
I am trying to port Pari/Gp (http://pari.math.u-bordeaux.fr/ ) to the Wii.
Pari/Gp uses widely the pipe functions (popen, pclose)
They are present in the stdio.h file. But the compilation
gives undefined reference to the function popen
undefined reference to the function pclose
the following test case shows the problem too
#include <stdio.h>
#define MAXSTRS 5
int main(void)
{
int cntr;
FILE *pipe_fp;
char *strings[MAXSTRS] = { "echo", "bravo", "alpha",
"charlie", "delta"};
/* Create one way pipe line with call to popen() */
if (( pipe_fp = popen("sort", "w")) == NULL)
{
perror("popen");
return 1;
}
/* Processing loop */
for(cntr=0; cntr<MAXSTRS; cntr++) {
fputs(strings[cntr], pipe_fp);
fputc('\n', pipe_fp);
}
/* Close the pipe */
pclose(pipe_fp);
return(0);
}
/opt/devkitPro/devkitPPC/bin/powerpc-eabi-gcc test.c
/tmp/cczYXw9b.o: In function `main':
test.c:(.text+0x6c): undefined reference to `popen'
test.c:(.text+0xf0): undefined reference to `pclose'
collect2: ld returned 1 exit status
I am trying to port Pari/Gp (http://pari.math.u-bordeaux.fr/ ) to the Wii.
Pari/Gp uses widely the pipe functions (popen, pclose)
They are present in the stdio.h file. But the compilation
gives undefined reference to the function popen
undefined reference to the function pclose
the following test case shows the problem too
#include <stdio.h>
#define MAXSTRS 5
int main(void)
{
int cntr;
FILE *pipe_fp;
char *strings[MAXSTRS] = { "echo", "bravo", "alpha",
"charlie", "delta"};
/* Create one way pipe line with call to popen() */
if (( pipe_fp = popen("sort", "w")) == NULL)
{
perror("popen");
return 1;
}
/* Processing loop */
for(cntr=0; cntr<MAXSTRS; cntr++) {
fputs(strings[cntr], pipe_fp);
fputc('\n', pipe_fp);
}
/* Close the pipe */
pclose(pipe_fp);
return(0);
}
/opt/devkitPro/devkitPPC/bin/powerpc-eabi-gcc test.c
/tmp/cczYXw9b.o: In function `main':
test.c:(.text+0x6c): undefined reference to `popen'
test.c:(.text+0xf0): undefined reference to `pclose'
collect2: ld returned 1 exit status