cancel
Showing results for 
Search instead for 
Did you mean: 

error when i using a function in a class in cpp

mhdizgah
Associate II
Posted on October 01, 2014 at 22:37

hi every body

in a cpp file i include a header file and want to use header file's functions inside class but it shows a error:

    lib1.h

    class class_x{

    public:

    calss_x();

    private:

    }

---

    lib1.cpp

    &sharpinclude ''lib1.h''

    &sharpinclude ''header1.h''

    class_x::class_X()

    {

    function_of_header1.h();

    }

error shows undefine symbol function_of_header1.h()

whas matter?

WBR

#cpp #class
1 REPLY 1
chen
Associate II
Posted on October 02, 2014 at 10:46

Hi

''error shows undefine symbol function_of_header1.h()

whas matter?''

Have you applied the ''extern c'' to the header?

http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c

The same thing needs to be done for C++ code to access C code.