English 中文(简体)
五C++外部运行的方案
原标题:Programming in VC++ to run outside Windows

我对第五C++的方案规划有以下问题: 2008年

  1. If I make a Win32 Console Program in Windows 7 will it work in any Windows below 7?
  2. Can I make a C++ Application independent of the .NET Framework? If yes, please brief me on how to do it.
  3. Can I make applications in VC++ to be run on other operating systems like Linux provided it can run .exe files? If yes, please brief me on how to do it.

I am learning VC++ and just wanted to get the about doubts cleared. Hope they will be cleared soon!

Thanks in advance and Cheers

最佳回答

1> Depends:如果不使用任何视窗7特定天气预报器,则你不会在视窗上操作节目;如果你不使用任何特定天气预报器,你不会在XP上出现任何问题。

2> Sure, you just need to make a native only project instead of a C++/CLI one

3> 你们需要一个像“双赢”这样的支持者,以管理在lin子下可执行的窗口。

问题回答

大部分......但铭记这一点:

如果你想要没有方案。 NET框架在创建新项目时选择任何“Visual C++”项目,但不使用《刑法》的任何项目。

本地C++(设计或窗户)将运行在旧的Windows操作系统上,只要你在功能电话上没有链接,或者只有新运行系统才有软件。 例如,不打电话

我认为,通过利用“WINNT_WIN32”的定义,你可以防止意外使用新软件。

The other consideration with native C++ applications on Windows is that by default, Visual C++ will choose dynamic linking for including the C-RunTime (e.g. msvcrt100.dll). These DLLs aren t always available on the machines you copy your EXE to. When you run your EXE on a different computer, you might get an application error about not being able to find MSVCRT*.dll. If this happens, you can either switch to static linking in the project settings (and then just copy the EXE directly to the other machines), or pre-install the appropriate MSVCRT on the other computers you want to run your EXE on. Visual Studio pre-installs the MSVCRT as part of its own setup. And Visual Studio ships with MSI files for installing MSVCRT that you can redistribute. Debug builds of your EXE may require some manual copying of the debug build of MSVCRT DLLs to target machines. Choose static linking for debug builds or just have debug builds of your app link with retail MSVCRT.

The same consideration holds true for MFC and it s associated DLLs if you choose to use that framework for UI Development. (But you said console apps, so you don t have to worry about this).

你的EXE在无几 ha的情况下获得过光线。 (比较容易)。 但是,如果你在www.NET中规划了你的黄色应用,EXE与Mono一道,很有可能将林丹投向北欧。

  1. It will probably run fine unless you are using WinAPI which has been introduced in later releases of Windows. Generally, if its important for you pay attention to MSDN, it contains a section called "Minimum operating systems".
  2. Already answered by @AlessandroV, generally just turn if off in project settings. I think its Off by default (for Win32 Console Application, that is)
  3. EXEs can be natively executed only on Windows, on linux there is software which allows EXEs to execute (Wine), however the performance is worse than running a natively compiled project for the specific OS. In order to have the best performance, and do things right the project should be compiled with that os s native compiler. This will succeed provided you use functions which are not OS specific (not WinAPI). If you will be using libc you should be fine. There are several open source libraries available which make writing cross-platform code easier, boost is one of them.

Good luck.

3. 如果你写上便携式C++专有应用程序(不是使用视窗特定功能),那么你就能够利用一些汇编者瞄准该平台,对其他平台进行改装。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签