我怎样才能在VS中编写c / c ++代码但是到处运行它! [英] how can i write c/c++ code in VS but run it everywhere!!

查看:67
本文介绍了我怎样才能在VS中编写c / c ++代码但是到处运行它!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能吗?



i希望在VS中编码,但我可以在linux,android或其他任何地方运行它,怎么可能?

is it possible?

i want to coding in VS but i can run it in linux , android or anywhere , how it will be possible?

推荐答案

目前在C ++中这很难。有些人说不可能这是不正确的,但它需要非常深入地了解Windows和Linux以及Android等之间的相同和不同之处。

我一直在研究这个问题并解决了10年来的许多问题,但解决方案尚未完成。如果您在Code Project文章中搜索我的文章QOR简介,或者在SourceForge上搜索 QOR ,您会发现到目前为止我发布的内容包括一个非常小的测试程序,它将在Windows和Linux上构建和运行七种不同的编译器/ IDE组合。除了在其他IDE下构建的项目之外,几乎所有这些都是用Visual Studio编写的。在另一种系统的一个系统上构建称为交叉编译。 Visual Studio无法为Linux执行此操作,因此我构建Linux for Linux和Windows上的Windows,但代码相同,来自共享网络驱动器。

在不久的将来,它将成为可能用C ++构建一个应用程序,在Linux,Windows,Android,32位和64位版本的OSX上构建和运行它,使用您选择的编译器,如果您想在Visual Studio中编写所有代码,您可以。这是梦想,我知道如何实现它,但我只有10个手指,一天24小时。 :-)

现在你可以看看Java或Mono但是如果C ++是你的东西那么道路就更难了但结局会更好。
At the moment this is very hard in C++. Some people have said it is impossible which is not correct but it requires very deep knowledge of what is the same and what is different between Windows and Linux and Android etc.
I have been working on this exact issue and have solved many of the problems over 10 years but the solution is not yet complete. If you search for my article "Introduction to the QOR" on Code Project articles or for QOR on SourceForge you will find what I have published so far which includes a very small test program that will build and run on Windows and Linux with seven different compiler/IDE combinations. Almost all of this except for the projects to build under other IDEs was written in Visual Studio. Building on one system for another kind of system is called cross-compiling. Visual Studio cannot do this for Linux so I build on Linux for Linux and for Windows on Windows but the code is the same and comes from a shared network drive.
In the near future it will be possible to build one application in just C++ and build and run it on Linux, Windows, Android, OSX in 32bit and 64bit versions, with the compiler of your choice and if you want to write all the code in Visual Studio you can. This is the dream and I know how to achieve it but I only have 10 fingers and 24 hours in the day. :-)
For now you could look at Java or Mono but if C++ is your thing then road is harder but the end is better.


任何控制台应用程序(即没有UI)只需链接到crt库就可以在任何平台上运行。源应该是普遍兼容的,但它需要为每个平台单独编译。



如果你想使用通用UI,你需要改变到另一种语言,如java。 Visual Studio无法帮助您了解详细信息。
Any console app (ie. no UI) that just links to the crt libraries should run on any platform. The source should be universally compatible but it will require a separate compile for each platform.

If you want to use a ''universal UI'' you will need to change to another language such as java. Visual Studio will not help you with that detail.


这篇关于我怎样才能在VS中编写c / c ++代码但是到处运行它!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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