Boost Windows 程序可以移植到其他 Windows 系统吗?

发布于 2024-10-05 15:04:35 字数 224 浏览 0 评论 0原文

我正在考虑一个程序的两种选择。使用 Boost Asynchronous IO 的 C++ 或使用异步 NIO 的 Java。我知道只要系统有java运行时,Java就是可移植的。我更喜欢将 C++ 与 Boost 结合使用,但我不确定我编写的程序是否可以移植到不同的 Windows 计算机上并仍然运行。我需要做什么来确保程序在运行时具有所有必要的依赖项?我计划仅使用 windows.h、C++ 2003 标准和 Boost 库。

I'm considering two options for a program. Either C++ with Boost Asynchronous IO or Java with the asynchronous NIO. I know that Java is portable so long as the system has the java run time. I'd prefer to use C++ with Boost but I'm not sure if the program I write can be ported to a different Windows machine and still run. What do I need to do to ensure that the program has all necessary dependencies at runtime? I plan on only using the windows.h, C++ 2003 standard, and the Boost libraries.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个ˇ局外人 2024-10-12 15:04:49

只要您使用 Boost、C++ 标准库(以及 CRT,如果您认为必须的话),您的代码就会很容易移植。

确保避免使用任何 Microsoft CRT 扩展,例如 str*_s 函数(例如 此处) - 不幸的是,MSDN 并没有很好地将这些标记为非标准。

还要避免在 Visual C++ v10 中使用 C++0x 功能,以在短期内最大限度地提高可移植性 - 或者检查您要使用的其他编译器是否具有您计划使用的功能。

小心:如果您使用 windows.h 中的一堆内容,您将破坏可移植性并增加您需要做的工作。如果您确实希望稍后移植,并且确实需要从那里获取任何内容,请尽可能避免这种情况,请尝试将用法隔离在不同的“我需要在移植时更改此”头文件和您自己的代码文件中,这样您就可以知道在移植到另一个操作系统时您只需要查看代码的子集。

So long as you use Boost, the C++ Standard Library (and the CRT, if you feel you must), your code will port pretty easily.

Make sure you avoid any Microsoft CRT extensions such as the str*_s functions (e.g. here) - MSDN does not flag these very well as nonstandard, unfortunately.

Also avoid using C++0x features in Visual C++ v10 to maximize portability in the short term - or check the other compilers you are targeting have the features you plan to use.

Be careful: If you use a bunch of stuff out of windows.h, you will break portability and increase the work you need to do. Avoid this as much as possible if you do expect to port later, and if you do need anything from there, try to isolate the usage in distinct 'I need to change this when I port' header and code files of your own, so you know you only need to look at that subset of your code when porting to another OS.

昔梦 2024-10-12 15:04:47

boost 和 CRT 可以静态链接到您的可执行文件,因此根本不会有任何外部依赖项。

boost and CRT can be linked statically to your executable, so there won't be any external dependencies at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文