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


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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

jfz2004Author Commented:
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
jfz2004Author Commented:

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

Did I miss anything here?


jfz2004Author Commented:
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?
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".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.