用于目标操作系统Windows和Linux的Visual Studio应用程序 [英] Visual Studio Application for Target OS Windows and Linux

查看:98
本文介绍了用于目标操作系统Windows和Linux的Visual Studio应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须开发一个应用程序,该应用程序为CAN设备实现Windows API,并测试将系统和CANUSB与主机PC相连的系统.
我可以使用C ++或C#.
该应用程序必须同时在Linux和Windows PC上运行.

问题:

这可能吗?

我可以在哪种环境下使用:Visual Studio或Eclipce CDT?

感谢您的帮助:)

I have to develop an application, which implements an windows API for CAN Device and test a System wich is connected wich and CANUSB with the host PC.
I can use C++ or C#.
The application must be run on both Linux and Windows PC.

Questions:

Is this possible?

Which enviroment can i use for this: Visual Studio or Eclipce CDT?

Thank you for your help :)

推荐答案

绝对有可能.我知道的最流畅的方法是在Linux上使用Mono.

参见:
http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ],
http://www.mono-project.com/ [ http://en.wikipedia.org/wiki/MonoDevelop [ http://monodevelop.com/ [ ^ ].
Windows和Linux都可以使用它,但是您不必使用它.

这个IDE非常好,它可以完成所有工作,但不如Visual Studio好.因此,我很少使用MonoDevelop,仅用于调试平台特定的代码.实际上,我在Windows上使用Visual Studio进行开发,甚至使用特定于平台的非Windows部分的代码;使用.NET,这很有可能,除非您不对其进行调试,所以我主要将MonoDevelop用于调试.这些天,我也在Max OS X上进行开发,在CLR上开发比在Linux上困难得多,并且仍然主要在Windows和Visual Studio上工作,几乎不必在其他平台上调试代码-我设法使其能够正常工作使用Windows.

您还可以在所有平台上使用C ++/CLI进行开发.

这样的可能性确实令人惊讶,而且以前从未有过.

除了.NET,CLR和Mono,还有其他开发跨平台UI的方法.与CLR不同,它们都需要在每个平台上重新编译.它们基于跨平台的Qt框架(以前由Trolltech组成,现在已由诺基亚支持)或GTK +工具箱,它们均可在Windows,Linux,Max OS X和其他平台上使用.参见:
http://en.wikipedia.org/wiki/Qt_%28framework%29 [ ^ ],
http://qt.nokia.com/ [ ^ ],
http://en.wikipedia.org/wiki/GTK [ http://www.gtk.org/ [ ^ ].

我对Qt或GTK +并没有真正的经验,只是对它们进行了最少的尝试.

我列出了目前我所知道的涉及C ++或C#的所有跨平台UI可能性.
我没有提到Java或Free Pascal,因为您只在C ++和C#上查询过.

—SA
Absolutely possible. The most smooth way I know is using Mono on Linux.

See:
http://en.wikipedia.org/wiki/Mono_%28software%29[^],
http://www.mono-project.com/[^].

Mono provides good implementation of CLR and very tight compatibility with .NET. It implements all the standard library and some non-standard ones, importantly System.Windows.Forms, but unfortunately not WPF. I run on Linux all my Forms applications built on Windows, without recompilation. Never faced any problems with Forms starting from the time when .NET version 3.5 was introduced. Also, I recommend to target applications to .NET Framework v.3.5 even now.

Now, the cross-platform IDE is available, called MonoDevelop, see:
http://en.wikipedia.org/wiki/MonoDevelop[^],
http://monodevelop.com/[^].
It is available for both Windows and Linux, but you don''t have to use it.

This IDE is pretty good and it does all it has to, but not as good as Visual Studio. So, I use very little of MonoDevelop, only for debugging of platform-specific codes. In fact, I develop on Windows with Visual Studio even platform-specific non-Windows part of codes; with .NET this is quite possible unless you don''t debug it, so I use MonoDevelop mostly for debugging. I also develop on Max OS X these days, where CLR development is much more difficult then in Linux, and still work mostly on Windows and Visual Studio, having to debug the code on other platforms pretty rarely — I manage to get it to work just using Windows.

You can also develop using C++/CLI for all the platforms.

Such possibilities are really amazing and were never available earlier.

Beyond .NET, CLR and Mono, there are other ways to develop cross-platform UI. Unlike CLR, they all require recompilation on each platform. They are based on cross-platform Qt framework (formerly form Trolltech, now supported by Nokia) or GTK+ toolkit, both available on Windows, Linux, Max OS X and other platforms. See:
http://en.wikipedia.org/wiki/Qt_%28framework%29[^],
http://qt.nokia.com/[^],
http://en.wikipedia.org/wiki/GTK[^],
http://www.gtk.org/[^].

I''m not really experienced with Qt or GTK+, just minimally tried them out.

I listed all the cross-platform UI possibilities involving C++ or C# I know at the moment.
I did not mention Java or Free Pascal because you inquired only on C++ and C#.

—SA


许多CAN USB适配器都带有讨厌的DLL,您需要对其进行"PInvoke"(如窥视/戳戳).它们不是为使用托管代码的现代语言设计的.您必须编写/使用"C#包装器"来访问DLL.您不能将它们添加到VS2010中并开始使用它们.
分发应用程序时-用户必须先安装USB硬件驱动程序,然后安装DLL(它将Windows系统目录中的各种垃圾填满),然后再安装应用程序.应用程序与DLL对话,而DLL与USB驱动程序对话,USB驱动程序与硬件对话. uck.

因此,如果您想要一个使用非常简单的USB硬件设备驱动程序(来自FTDI)和ac#库(而不是可怕的DLL)的解决方案,而该解决方案在您的项目中实际上被引用(或链接为?).以源代码形式提供.并且是开源的.并且可以编译为64位代码.然后这就是您应该查看的解决方案
http://sourceforge.net/projects/canusb/
(注意:您需要从SVN/CVS中提取项目,因为zip文件可能很旧.) 它也恰好是最便宜的CAN硬件设备之一..
该库也可以使用Mono而不是VS2010进行编译
一些关键字:
CAN USB适配器C#库64位CANUSB托管代码.NET库,没有DLL废话!

我讨厌使用DLLs.从非托管代码中回调,这些代码会使系统目录膨胀..需要安装权限..无法重新编译等等..
如果您使用的是C#,那么这是正确的方法.
Hi, many CAN USB adaptors come with nasty DLLS that you need to ''PInvoke'' (like peek/poke). They were not designed for modern languages that use managed code. You have to write/use a ''C# wrapper'' to access the DLL. You can NOT add them to your VS2010 and start using them.
When you distribute your application - the user has to install USB hardware drivers, then install DLLs (which fills the windows system directory with all kinds of rubbish), then your application. The application talks to the DLL which talks to the USB driver which talks to the hardware. Yuck.

So.. If you want a solution that uses a very simple USB hardware device driver (from FTDI) and a c# library (instead of the dreaded DLL) that is actually referenced (or linked?) as managed code in your project.. AND is provided in source code form.. And is open source.. And can be compiled as 64bit code.. Then this is the solution you should be looking at
http://sourceforge.net/projects/canusb/
(Note: You will need to take the project from SVN/CVS as the zip file may be old..)
It also happens to be one of the cheapest CAN hardware devices out there..
The library can also be compiled with Mono instead of VS2010
Some keywords:
CAN USB adaptor C# library 64bit CANUSB Managed code .NET library with no DLL nonsense!

I hated working with DLLs.. callbacks from an unmanaged code that bloats the system directory.. that needs permissions to install.. can’t be recompiled and so on..
If you are working with C#, then it’s the right way to do it..


这篇关于用于目标操作系统Windows和Linux的Visual Studio应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆