VS6 : Fatal error C1021: invalid preprocessor command 'using'

B

Boris Kuznetsov

This occurs in an empty project when I add the following string:

#using <mscorlib.dll>

Can anyone tell me why would #using ... not be working???? MSDN says nothing
about this error.
Please advice what to do??

mailto:
(e-mail address removed)-kpi.kiev.ua
 
J

John Harrison

Boris said:
This occurs in an empty project when I add the following string:

#using <mscorlib.dll>

Can anyone tell me why would #using ... not be working???? MSDN says nothing
about this error.
Please advice what to do??

mailto:
(e-mail address removed)-kpi.kiev.ua

#using is not part of the standard C++ language, it is a microsoft
extension and therfore you need a microsoft group.
for instance.
 
J

Jim Langston

Boris Kuznetsov said:
This occurs in an empty project when I add the following string:

#using <mscorlib.dll>

Can anyone tell me why would #using ... not be working???? MSDN says
nothing about this error.
Please advice what to do??

(Since I don't believe this is actualy a Microsoft problem I'm answering it
here).

Error C1021 basically says, No such thing as #using

So, #using <mscorlib.dll> is neither Microsoft, or C++. What is it you
are trying to do?

I believe you actually want to include the header file(s) for mscorlib using
#include
and link mscorlib.dll to your program (you'll need to read docs or check
microsoft
newsgroup for that one).
 
M

Mike Wahler

Boris Kuznetsov said:
This occurs in an empty project when I add the following string:

#using <mscorlib.dll>

First let's ask: What prompted you to write such a line?
Can anyone tell me why would #using ... not be working????

Well, it doesn't work in the standard C++ language (the only topic here),
because it has no such directive. Did you perhaps really intend to
write:

#include said:
MSDN says nothing about this error.

It certainly does.

From
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/C1021.asp

== begin quote ==

Visual C++ Concepts: Building a C/C++ Program

Fatal Error C1021
invalid preprocessor command 'string'


string is not a valid preprocessor directive. To resolve the error,
use a valid preprocessor name for string. The following sample
generates C1021:

// C1021.cpp
#BadPreProcName // C1021, delete line
int main() {
}

== begin quote ==
Please advice what to do??

Use a valid preprocessor directive, or if that string is some
special Microsoft extension, consult your documentation and/or
a Microsoft specific newsgroup about how to use it, when, why,
etc.

-Mike
 
P

persenaama

Did you perhaps really intend to write:
#include <mscorlib.dll>

No, mscorlib.dll is part of Managed C++ / .NET and #using is how the
component is used and has nothing to do with non-managed ISO/IEC C++.
What he wrote is correct in that part, just off-topic.

He should consult his project settings to see if the managed
compilation is enabled or not and proceed to appropriate groups for
follow-up questions.
 
R

Ron Natalie

persenaama said:
No, mscorlib.dll is part of Managed C++ / .NET and #using is how the
component is used and has nothing to do with non-managed ISO/IEC C++.
What he wrote is correct in that part, just off-topic.

Visual Studio 6 has no clue what Managed C++ / .NET is, which is
probably therefore his problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top