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

Discussion in 'C++' started by Boris Kuznetsov, Sep 11, 2005.

  1. 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:
    -kpi.kiev.ua
     
    Boris Kuznetsov, Sep 11, 2005
    #1
    1. Advertising

  2. Boris Kuznetsov wrote:
    > 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:
    > -kpi.kiev.ua
    >
    >


    #using is not part of the standard C++ language, it is a microsoft
    extension and therfore you need a microsoft group.
    news:microsoft.public.vc.language for instance.
     
    John Harrison, Sep 11, 2005
    #2
    1. Advertising

  3. Boris Kuznetsov

    Jim Langston Guest

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

    "Boris Kuznetsov" <-kpi.kiev.ua> wrote in message
    news:dg0uh3$eti$-kpi.kiev.ua...
    > 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).
     
    Jim Langston, Sep 11, 2005
    #3
  4. Boris Kuznetsov

    Mike Wahler Guest

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

    "Boris Kuznetsov" <-kpi.kiev.ua> wrote in message
    news:dg0uh3$eti$-kpi.kiev.ua...
    > 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 <mscorlib.dll>

    >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
     
    Mike Wahler, Sep 11, 2005
    #4
  5. Boris Kuznetsov

    persenaama Guest

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

    > 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.
     
    persenaama, Sep 12, 2005
    #5
  6. Boris Kuznetsov

    Ron Natalie Guest

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

    persenaama wrote:
    >>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.


    Visual Studio 6 has no clue what Managed C++ / .NET is, which is
    probably therefore his problem.
     
    Ron Natalie, Sep 12, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Chau
    Replies:
    0
    Views:
    608
    Andy Chau
    Nov 20, 2003
  2. MBB
    Replies:
    2
    Views:
    401
    Leon Mayne [MVP]
    Oct 26, 2005
  3. JeC

    JAXB for Win32 C++ VS6

    JeC, Aug 8, 2003, in forum: XML
    Replies:
    0
    Views:
    1,370
  4. vincent wehren
    Replies:
    0
    Views:
    438
    vincent wehren
    Dec 11, 2003
  5. Andrew  Luke
    Replies:
    3
    Views:
    807
    Dave Rahardja
    Sep 9, 2005
Loading...

Share This Page