Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2005

Tip: Looking for answers? Try searching our database.

Is it possible to compile and run c programs in the visual C++ .NE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kueishiong Tu - 25 Oct 2005 11:52 GMT
I have a bunch of C programs from sun. I would like to port them over to PC.
I am wondering if I can simply recompile and run them in Visual C++ .NET
without
having to making a lot of changes? Specifically how to invoke C run time
library from Visaul C++ .NET?
Jochen Kalmbach [MVP] - 25 Oct 2005 12:03 GMT
Hi Kueishiong!

> I have a bunch of C programs from sun. I would like to port them over to PC.
> I am wondering if I can simply recompile and run them in Visual C++ .NET
> without
> having to making a lot of changes? Specifically how to invoke C run time
> library from Visaul C++ .NET?

MS C++(.NET) is a "normal" C/C++ compiler, so you can just create a
project and insert all c/cpp-files.
It also supports the standard C-Runtime.
So there should be no "big" problem if you only relay on the CRT...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

Kueishiong Tu - 25 Oct 2005 12:31 GMT
Hi Jochen!

When I create a new console project, the template main function created is
always a C++ file from VC++ .NET. Is it possible to create a new project with
the template main function created a C file? Also is it possible to have a
project with both C and C++ source files?

> Hi Kueishiong!
>
[quoted text clipped - 8 lines]
> It also supports the standard C-Runtime.
> So there should be no "big" problem if you only relay on the CRT...
Jochen Kalmbach [MVP] - 25 Oct 2005 12:39 GMT
Hi Kueishiong!

> When I create a new console project, the template main function created is
> always a C++ file from VC++ .NET. Is it possible to create a new project with
> the template main function created a C file?

There is no template for C-files. But you can simply rename the
"cpp"-extension to "c" (or delete the file and create a new one).

You also should be sure to disable "pre-compiled headers" (in project
properties "C/C++|Precompiled headers".

> Also is it possible to have a
> project with both C and C++ source files?

Yes, there is no problem with that.

Just a small note:
If you want to include "c"-headerfiles then you must be sure that you
put the following around them (or include this in the h-file):

#ifdef __cplusplus
extern "C" {
#endif

#include "your-c-h-file.h"

#ifdef __cplusplus
}
#endif

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.