1

I have 3 projects A, B, C. C depends on B. B depends on A. A has a type X defined in X.h. However when B uses it in a UseB.h file without include X.h. B project can built in VS2013. However, when I maintain project C, it cannot build because X type is not defined so UseB.h cannot compile.

Any MS C++ guru know about this?

Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
N Sin
  • 9
  • 1
  • I cannot simply do this because there are other types defined in X.h. That will introduce more redefinition errors. – N Sin Mar 07 '16 at 04:58
  • 1
    http://stackoverflow.com/questions/625799/resolve-circular-dependencies-in-c – M.M Mar 07 '16 at 07:02
  • 1
    You should fix the error instead of finding workarounds. – Bryan Chen Mar 07 '16 at 07:56
  • "I have a messed up project and I want it to magically work without cleaning up the mess". Nope, doesn't work this way. Clean up the mess. Identify declarations in X.h that other projects need, and extract them into a separate header file. – n. m. could be an AI Mar 07 '16 at 10:27

1 Answers1

0

Just figure out that in stdafx.h of project B includes a header includes X.h controlled enabled/disabled by preprocessor. There are further work to enable it. So it's not a tricky compiler problem.

N Sin
  • 9
  • 1
  • Please consider adding more details to your answer, so that it answers the original question. See [answer]. – VLL Mar 07 '16 at 09:16