Using mscorlib & system namespace in an MFC?

This is a discussion on Using mscorlib & system namespace in an MFC? within the C++ Programming forums, part of the General Programming Boards category; Hey there, last question for a while I swear I've become somewhat familiar with the functions associated under System:: but ...

  1. #1
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Using mscorlib & system namespace in an MFC?

    Hey there, last question for a while I swear

    I've become somewhat familiar with the functions associated under System:: but can't seem to figure out how to use them in a MFC app. Whenever I try to compile get errors that System is not a namespace and mscorlib.dll must be compiled using /clr method. I've added /clr and also tried CL to compile but got errors there too.
    I've added references to System under COM for my project but it didn't work and don't seem to have the feature for creating managed C++ apps with my program.

    Does this mean I have to forget everything I know in C++ to learn .NET?

    All I want to add is this:
    Code:
    #using <mscorlib.dll>
    using namespace System;
    That's all!

    Thanks,

    Rob Sitter

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Why would you want to use .Net and MFC in the same program? Just curious ...

    Can you post the errors?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    9
    Yep, give us some error messages.

    You don't need that #using line to use C++/CLI.

    You need to add a reference in your project to System and whatever other stuff you'll be using

    You need to turn /CLR, RTTI, and SEH exceptions ON for any source files that you want to use C++/CLI in.

    You need to link against the multithreaded DLL runtime libraries.

  4. #4
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Dumb, argh, newbie mistake, consider this thread closed.

    Got it
    Last edited by Robert_Sitter; 11-14-2005 at 09:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern namespace?
    By Brafil in forum C++ Programming
    Replies: 2
    Last Post: 01-10-2009, 07:06 AM
  2. namespace problem
    By DL1 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2008, 12:10 PM
  3. MFC support in ATL project
    By Arkanos in forum Windows Programming
    Replies: 2
    Last Post: 01-29-2006, 04:15 PM
  4. Cannot convert system object to system string?
    By Robert_Sitter in forum Windows Programming
    Replies: 0
    Last Post: 11-18-2005, 01:44 PM
  5. MFC in an empty project
    By cunnus88 in forum Windows Programming
    Replies: 0
    Last Post: 10-09-2005, 09:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21