How to port C++ from Unix to Window .Net C++ system?

Posted on 2004-11-17
Last Modified: 2010-04-24

I need to port a large C++ system on unix (built a long time ago)
into Visual C++ on windows XP (.NET).

There are many subdirectories in that system. It can't not even
find iostream.h in Visual Studio. How  shall I do it properly?

Thanks a lot.

Jennifer Zhou
Question by:jfz2004
    LVL 10

    Expert Comment

    Hi jfz2004,
    This is actually a big topic and can be quite complex or very simple depending on your application. But to fix that issue, the easiest way is to simply do
    #include <iostream>
    using namespace std;

    That should stop problems when using stuff from standard library.


    Author Comment

    Thanks so much. I will try that.

    Do you also have some ideas on how to treat subdirectories?
    Is it better to make them dlls or just  leave sub-dirs as they are?

    Jennifer Zhou

    Author Comment


    I just tried using namespace std; but the compiler says:
    'std' : a namespace with this name does not exist.

    Did I miss anything here?



    Author Comment

    Please ignore my last post. It's my fault. I placed
    "using namespace std" before #include <iostream.h>.

    But in C# I always put using... at the very begining. Why is
    it different here?
    LVL 19

    Accepted Solution

    In standard C++, the namespace does not exist until you include a file that defines it.  Putting a 'using namespace' statement before all the headers that define the namespace results in an error.  .NET, including managed C++, has a different notion of a reference so you can put "using" statements right at the top of the source file.  A "using" statement in .NET will gice you an error if there is not a reference to the assembly defining the namespace or if the namespace does not exist in the current VS Solution.  The main system assemblies are referenced by default in a new .NET project.  Expand the "References" in Solution Explorer for one of your C# projects to see this.  You are (or should be anyway) doing a standard C++ project, however, so that does not apply.

    As for the project directory structure, I'd parallel the original project as a first cut.  If the original project had libraries, make them dll's.  Otherwise, just put all the source into one VS project.  You can create a project folder - not file system folders but VS project folders - for each subdirectory to keep the project organized.  Right click on the project in Solution Explorer and do "Add -> New Folder".

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now