c function is used in .mm file

I use c function in .mm file. and project link error.

the error information is c function symbel can no be found in xxx.o.


the code is this, as follow:

in test.h and test.m file define c function.

for example,

void cfunction(); in test.h

void cfunction() in test.m

{

printf("hello world\n");

}


I use cfunction in oc class in octest.h octest.m

for excample,

@implement octest

- (void)ocprintfunction

{

cfunction();

}

@end


if octest.m file, build and link is ok and project run nomarlly.

if i modify octest.m to octest.mm, link is error. and error infomation is cfunction symbol can no be found in octest.o


if somebody know how to fix this issue , please tell me。


I find a method to fix this issue. c function must define in .cpp

c function is used in .mm file
 
 
Q