error when i using a function in a class in cpp

Status
Not open for further replies.

dizgah

Member level 5
Joined
Nov 8, 2009
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
iran-8par
Visit site
Activity points
2,049
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:

Code:
    lib1.h
    class class_x{
    public:
    calss_x();
    private:

    }
---

Code:
    lib1.cpp
    #include "lib1.h"
    #include "header1.h"
    class_x::class_X()
    {
    function_of_header1.h();
    }
error shows undefine symbol function_of_header1.h()
whas matter?
WBR
 

where is function_of_header1() decalared? in header1.h ?
what is the header1.h code?
note you cannot have a . in an identifier name such as function_of_header1.h()

should it be something like
Code:
//lib1.h
    class class_x{
    public:
    class_x();
    private:
    };

Code:
// header1.h
    void function_of_header1()
    {
    //
    }

Code:
   //lib1.cpp
    #include "lib1.h"
    #include "header1.h"
    class_x::class_x()
    {
    function_of_header1();
    }
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…