I have a .inc file written in C. This contains some defines and method signatures with their implementations.
.inc file:
#define CONCAT(x,y) x ## y
#define LCONCAT(x,y) CONCAT(x,y)
#define DLIST LCONCAT(LCONCAT(double_,LISTELEMENT),_list)
#define DELETEDFIRST LCONCAT(delete_first_double_,LISTELEMENT)
int DELETEDFIRST (DLIST **first, DLIST **last);
int DELETEDFIRST (DLIST **first, DLIST **last)
{...}
I want to bring this to c++. In my .h file I have the define directives and the method signatures (encapsulated within a namespace). and in the .cpp I have only the method implementations.
.h file
#define CONCAT(x,y) x ## y
#define LCONCAT(x,y) CONCAT(x,y)
#define DLIST LCONCAT(LCONCAT(double_,LISTELEMENT),_list)
#define DELETEDFIRST LCONCAT(delete_first_double_,LISTELEMENT)
namespace ListFunctions {
int DELETEDFIRST (DLIST **first, DLIST **last);
}
.cpp file
# include ListFunctions.h
namespace ListFunctions {
int DELETEDFIRST (DLIST **first, DLIST **last) {...}
}
I plan to use these list functions in the development of my module. In my module.h I define a type double_node_list (double ended) and in my module.cpp I define LISTELEMENT as "node" and then include the ListFunctions.h. But the same include in ListFunctions.cpp leads to compilation errors:
..\ListFunctions.h(86): error C2065:'double_LISTELEMENT_list' : undeclared identifier
..\ListFunctions.h(86): error C2065: 'first' : undeclared identifier
..\ListFunctions.h(86): error C2065: 'double_LISTELEMENT_list' : undeclared identifier
..\ListFunctions.h(86): error C2065: 'last' : undeclared identifier
..\ListFunctions.h(86): error C2078: too many initializers
Later I want to translate the c style implementations to c++. As I lack experience I want to know if others agree with what I am doing.