U
usr2003
I wrote the following test program to test the linkage directives
extern "C":
#include <stdio.h>
extern "C" {
void f();
void callingFWithParm();
}
void f()
{
printf("Function f()\n");
}
void callingFWithParm()
{
int i=0;
f(i);
}
int
main()
{
callingFWithParm();
}
I compiled with g++ on Red Hat Linux 9. But I got the following error:
"mix.cc: In function `void callingFWithParm()':
mix.cc:9: too many arguments to function `void f()'
mix.cc:16: at this point in file"
It's as if the linkage directive didn't work. If I take out the linkage
directive and compile with gcc, it works fine.
Could anybody explain this behavior? Any input would be greatly
appreciated.
extern "C":
#include <stdio.h>
extern "C" {
void f();
void callingFWithParm();
}
void f()
{
printf("Function f()\n");
}
void callingFWithParm()
{
int i=0;
f(i);
}
int
main()
{
callingFWithParm();
}
I compiled with g++ on Red Hat Linux 9. But I got the following error:
"mix.cc: In function `void callingFWithParm()':
mix.cc:9: too many arguments to function `void f()'
mix.cc:16: at this point in file"
It's as if the linkage directive didn't work. If I take out the linkage
directive and compile with gcc, it works fine.
Could anybody explain this behavior? Any input would be greatly
appreciated.