diff --git a/org.lflang/src/org/lflang/generator/c/CGenerator.java b/org.lflang/src/org/lflang/generator/c/CGenerator.java index 8861181b36..cee892365c 100644 --- a/org.lflang/src/org/lflang/generator/c/CGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CGenerator.java @@ -657,7 +657,6 @@ private void generateCodeFor( ) throws IOException { startTimeStepIsPresentCount = 0; code.pr(generateDirectives()); - code.pr(generateTopLevelPreambles()); code.pr(new CMainFunctionGenerator(targetConfig).generateCode()); // Generate code for each reactor. generateReactorDefinitions(); @@ -1043,6 +1042,7 @@ private void generateReactorClass(Reactor reactor) throws IOException { header.pr("#ifndef " + guardMacro); header.pr("#define " + guardMacro); generateReactorClassHeaders(reactor, headerName, header, src); + src.pr(generateTopLevelPreambles()); generateUserPreamblesForReactor(reactor, src); generateReactorClassBody(reactor, header, src); header.pr("#endif // " + guardMacro);