c++ - undefined reference to a static function -


i have strange problem when create static function in class , want call class b function.

undefined reference `a::funca(int)'

here source code : a.cpp

#include "a.h"  void funca(int i) {     std::cout << << std::endl; } 

a.h

#ifndef a_h #define a_h  #include <iostream>  class {     public:         a();         static void funca( int ); };  #endif // a_h 

b.cpp

#include "b.h"  void b::funcb(){     a::funca(5); } 

and b.h

#ifndef b_h #define b_h #include "a.h"  class b {     public:         b();         void funcb(); };  #endif // b_h 

i'm compiling code::blocks.

#include "a.h"  void funca(int i) {     std::cout << << std::endl; } 

should be

#include "a.h"  void a::funca(int i) {     std::cout << << std::endl; } 

since funca static function of class a. rule applies both static , non-static methods.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -