Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2005, 07:44 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I convert #include in C++ to using in C#

Hi, I am trying to convert this line of code, which is C++, to the proper syntax in C#.
C# does not use #include, so what would my using statement be for C#?
I looked in the books, but no help.
Please help as soon as possible!

#include "itc50.h"
 
Old February 11th, 2005, 12:31 AM
Authorized User
 
Join Date: Feb 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no equivalent. The #include statement actually causes the text of the header file to replace the #include statement. Then you've got to figure out how the actual header file contents translate to C# (good luck - try looking at some of those C++ header files...).


 
Old February 11th, 2005, 02:49 AM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if you have the source code for the header file. You can convert it to dll then use it in C# using the DllImport command. Search DllImport for example on how to use this.


I have not tried but I think if you create the Dll in Visual C++.NET , you should be able to use it in C# by just referencing to that dll. Much easier then using DllImport. And from there u can use "using XXXX " in order to use the variables and functions in the dll.


Hope this helps

 
Old February 11th, 2005, 12:55 PM
Authorized User
 
Join Date: Feb 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just remember that header files are not compilable on their own - they are just one part of the archaic definition/implementation separation in C++.








Similar Threads
Thread Thread Starter Forum Replies Last Post
c #include vicoldan Need help with your homework? 0 December 3rd, 2007 06:15 AM
Include in C# su C# 2 December 15th, 2006 04:59 AM
#include arielote C# 3 February 26th, 2006 07:54 PM
difference between include file & include virtual crmpicco Classic ASP Basics 2 January 23rd, 2006 11:50 AM
xsl:include within include chuck123ie XSLT 1 January 5th, 2006 11:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.