Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IDE Systems for Windows 7and other problems...

33 views
Skip to first unread message

TheGunslinger

unread,
Oct 28, 2011, 2:58:51 AM10/28/11
to
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.

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 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 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.
----------------------------------------------------------------------------
Question #2:

So, I need a recommendation for dedicated C- Language IDE system,
please, under Windows 7 (/sigh).

----------------------------------------------------------------------------

TIA,

MJR
--
comp.lang.c.moderated - moderation address: cl...@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.

James Kuyper

unread,
Oct 28, 2011, 3:19:58 PM10/28/11
to
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

Hans-Bernhard Bröker

unread,
Oct 28, 2011, 3:21:59 PM10/28/11
to
On 28.10.2011 08:58, TheGunslinger wrote:
> So, how many hierarchal layers does the C language support?

More than you know what to do with.

> I currently have a depth of 3 layers.
>
> messages.h/cpp --> main.cpp<-- menu.h/cpp<-- prompts.h/cpp<--
> externals.h/cpp.

How are those 3 layers? I see 4 (in a rather strange arrangement)

> The scope errors seem to appear if my new methods and variables are
> not in the same level.

You'll have to explain what you mean by "scope errors".

James Kuyper

unread,
Nov 2, 2011, 1:48:42 PM11/2/11
to
On 10/28/2011 03:21 PM, Hans-Bernhard Bröker wrote:
> On 28.10.2011 08:58, TheGunslinger wrote:
>> So, how many hierarchal layers does the C language support?
>
> More than you know what to do with.
>
>> I currently have a depth of 3 layers.
>>
>> messages.h/cpp --> main.cpp<-- menu.h/cpp<-- prompts.h/cpp<--
>> externals.h/cpp.
>
> How are those 3 layers? I see 4 (in a rather strange arrangement)

I think he's counting layers by the number of nested #include statements:
layer 1: main.cpp
layer 2: messages.h, menu.h
layer 3: prompts.h

Keith Thompson

unread,
Nov 2, 2011, 1:49:12 PM11/2/11
to
TheGunslinger <mikiesrun...@sbcglobal.net> writes:
> 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.
>
> 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.
> ----------------------------------------------------------------------------

Hierachical layers of what, exactly? Compilers might have limits on
levels of nesting of certain constructs, but 3 layers isn't going to
approach any of those limits. You'll need to show us some actual code.

And the ".cpp" suffix is used for C++ source files. If you're
programming in C, name the files with ".c" suffixes. I don't know
whether that will tell Qt Creator to treat them as C; check the
documentation and your project settings.

Keep in mind that C is *not* a subset of C++, though it comes fairly
close. Try declaring

int class;

in one of your source files. If the compiler accepts it, then it's
behaving like a C compiler (it's a syntax error in C++).

> 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.

C doesn't have anything called "methods". Do you mean functions?

> 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.
> ----------------------------------------------------------------------------
> Question #2:
>
> So, I need a recommendation for dedicated C- Language IDE system,
> please, under Windows 7 (/sigh).

I'm not much of an IDE user myself, but many of them can, with some
effort, be persuaded to compile C rather than C++. I'm fairly sure
Microsoft's Visual Studio can, for example.

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Hans-Bernhard Bröker

unread,
Nov 3, 2011, 11:24:04 PM11/3/11
to
On 02.11.2011 18:48, James Kuyper wrote:
> On 10/28/2011 03:21 PM, Hans-Bernhard Bröker wrote:
>> On 28.10.2011 08:58, TheGunslinger wrote:
>>> I currently have a depth of 3 layers.

>>> messages.h/cpp --> main.cpp<-- menu.h/cpp<-- prompts.h/cpp<--
>>> externals.h/cpp.

>> How are those 3 layers? I see 4 (in a rather strange arrangement)

> I think he's counting layers by the number of nested #include statements:
> layer 1: main.cpp
> layer 2: messages.h, menu.h
> layer 3: prompts.h

layer 4: externals.h

James Kuyper

unread,
Nov 4, 2011, 1:52:47 PM11/4/11
to
On 11/03/2011 11:24 PM, � wrote:
> On 02.11.2011 18:48, James Kuyper wrote:
>> On 10/28/2011 03:21 PM, Hans-Bernhard Br�ker wrote:
>>> On 28.10.2011 08:58, TheGunslinger wrote:
>>>> I currently have a depth of 3 layers.
>
>>>> messages.h/cpp --> main.cpp<-- menu.h/cpp<-- prompts.h/cpp<--
>>>> externals.h/cpp.
>
>>> How are those 3 layers? I see 4 (in a rather strange arrangement)
>
>> I think he's counting layers by the number of nested #include statements:
>> layer 1: main.cpp
>> layer 2: messages.h, menu.h
>> layer 3: prompts.h
>
> layer 4: externals.h

I don't know how I missed that; but possibly he missed it too.
Alternatively, what he's counting is the maximum number of nested
#include statements.
--
James Kuyper
0 new messages