On 10/28/2011 02:58 AM, TheGunslinger wrote:
> Sorry to bother.
>
> I am completing a C Language programming class.
>
> The instructor and I thought that I might be able to complete all the
> programming assignments using my IDE system from the C++ class last
> semester. (Nokia QT 4 Creator and libraries)
>
> However, the instructor found (and I corrected) some C++ coding
> infiltrating into my C assignments.
If your IDE is automatically inserting C++ code into your projects, the
way to turn off or avoid using that feature depends upon your IDE. This
is not the best place to look for answers to questions about Nokia QT 4
Creator. You should find a Nokia-specific forum to ask about such things.
> I have heavily modularized my code for readibility and simplicity in
> maintaining the code.
>
> BUT I am now frequently getting scope errors as below?
> ----------------------------------------------------------------------------
> Question #1:
>
> So, how many hierarchal layers does the C language support? I
> currently have a depth of 3 layers.
>
> messages.h/cpp --> main.cpp <-- menu.h/cpp <-- prompts.h/cpp <--
> externals.h/cpp.
The C standard requires that any conforming implementation of C must be
able to translate and execute at least one program which, among other
things, has more than "15 nesting levels for #included files". That
doesn't actually guarantee that you own code, with just three levels of
nested #includes, will actually work - it's incredibly unlikely that
your program is the "one program". However, it does mean that you can
reasonably object to any implementation which arbitrarily cuts you off
at less than 15 levels, when there's no other reason for doing so.
> ----------------------------------------------------------------------------
>
> The scope errors seem to appear if my new methods and variables are
> not in the same level. This is forcing me to re-declare some constants
> in additional layers.
I have only a vague idea what mistake you might be making. Please
provide the complete compilable code (all source code files, *.c and
*.h) for a simplified example program that won't compile unless you
re-declare a constant.
> I did not have these issues until the current assignment involving
> creating and using arrays.
>
> I suspect that the legacy support of the C language in C++ has been or
> is being reached, and these problems are only going to get worse
> before the end of the semester.
That sounds like you're using a C++ compiler as if it were a C compiler.
In a proper IDE, using the right compiler should just be matter of
setting up the configuration properly. A forum for discussing Nokia QT 4
Creator could probably tell you how to do that.
> Question #2:
>
> So, I need a recommendation for dedicated C- Language IDE system,
> please, under Windows 7 (/sigh).
Sorry - that I know nothing about.
--
James Kuyper