Programming Question in C/C++ for function Extention in Ocropus

1 view
Skip to first unread message

Leo

unread,
Aug 29, 2008, 6:06:43 AM8/29/08
to ocropus
Hi All,

I am trying do writing up some extended function in C/C++.
and I currently created two file "ocr-greenstone.cc", "ocr-
greenstone.h"

my question is that for all the functions that I implemented in .cc
file all within namespace ocropus {}
do I need to add all the function header to .h file? also I defined
some "struct" and "typedef struct" in .cc file
do I need to add those into .h file as well?

sorry for the rookie questions, as I am bit rusty on C language and
just starting to get familiar with coding int Ocropus (+_+)?

Regards,
Leo

Faisal Shafait

unread,
Aug 29, 2008, 6:38:42 AM8/29/08
to ocr...@googlegroups.com
my question is that for all the functions that I implemented in .cc
file all within namespace ocropus {}
do I need to add all the function header to .h file? also I defined
some "struct" and "typedef struct" in .cc file
do I need to add those into .h file as well?

You need to add all those function declarations to a .h file that you want to be usable from other .cc files. Functions that are used only in a single .cc file for doing some intermediate steps and are not general purpose should be made static and should not be declared in the header file. You should add declarations for classes and typedefs in the header files so that they are usable in multiple .cc files.

Cheers,
Faisal
Reply all
Reply to author
Forward
0 new messages