-
Couldn't load subscription status.
- Fork 264
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The current system for creating and using classes outside the main cpp2 file is to write a file with the extension .h2 containing the classes that are needed, then put #include "myheader.h2" at the top of the cpp2 file. The idea is that
- cppfront creates two files from the h2 file: a .h file containing declarations, and a .hpp file containing definitions.
- cppfront translates
#include "myheader.h2"in the cpp2 file into two statements in the generated cpp file:#include "myheader.h"at the top, and ... #include "myheader.hpp"later on.
Steps 1 and 2 work, but step 3 does not. No #include "myheader.hpp" statement is added by cppfront to the generated cpp file.
Suggested fix (works for me, but I have not analysed the code and the fix may not be correct in all circumstances): move the statement printer.print_extra( hpp_includes ); in to_cpp1.hpp out of its conditional block. Here is a patch:
source/to_cpp1.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/to_cpp1.h b/source/to_cpp1.h
index 75880d5..b7f713d 100644
--- a/source/to_cpp1.h
+++ b/source/to_cpp1.h
@@ -1519,9 +1519,9 @@ public:
printer.print_extra( "\n#ifndef " + cpp1_FILENAME+"_CPP2" );
printer.print_extra( "\n#define " + cpp1_FILENAME+"_CPP2" + "\n\n" );
- printer.print_extra( hpp_includes );
}
+ printer.print_extra(hpp_includes);
//---------------------------------------------------------------------
// Do phase2_func_defs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working