本文介绍了从Code :: Blocks移植到Visual Studio 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个开源C :: B C ++(非C ++ 11,完全兼容1998 ISO标准)项目,我下载了使用MinGW / GCC(TDM-1 4.7.1或4.7 .2 - 不能使用最新版本),;我可以将源文件从它到Visual Studio 2010,并能够使它工作没有大规模代码重写?或者在某些情况下是不可能的?



编辑:
代码依赖于额外的外部实用程序和库,例如:




  • Lua

  • SDL 2.0 + SDL Image 2.0

  • OpenGL


解决方案

最常见和正确的回应是:取决于各种事情

你指的是什么样的项目?是wxWidget,QT4,GTK +,OpenGL?
你使用c ++ 11多少钱?



假设我们在谈论一个简单的控制台应用程序验证是否可以迁移到MSVC2010的最简单方法是在Code :: Blocks项目中切换编译器。



选择 Project->构建选项... 选择的编译器选择 Microsoft Visual Studio C ++ 2010 。然后尝试重新编译。



当然,你也必须用MSVC2010安装Code :: Blocks。



编辑:MSVC2010支持OpenGL库,libsdl有VC开发库。然而,事情似乎更加复杂与Lua。我的猜测是,你可能在这里开始大量移植工作。


Say I have a open source C::B C++ (non-C++11, perfectly compatible with the 1998 ISO standard) project I've downloaded which is using MinGW/GCC (TDM-1 4.7.1 or 4.7.2 - doesn't work with newest version),; can I port the source files from it to Visual Studio 2010 and be able to make it work without massive code rewriting? Or there are certain cases in which it won't be possible? Or it depends on various things?

EDIT:The code relies on additional external utilities and libraries such as:

  • Lua
  • SDL 2.0 + SDL Image 2.0
  • OpenGL

解决方案

The most General and correct response is: It depends on various things.

What kind of project are you refering to? Is it wxWidget, QT4, GTK+, OpenGL?How much do you use c++11?

Assuming that we are talking about a simple Console Application the easiest way to verify whether you can migrate to MSVC2010 is to switch compiler inside Code::Blocks project.

Select Project->Build Option... and under Selected compiler choose Microsoft Visual Studio C++ 2010. Afterwards try to recompile. The warning and errors will show you how easy will be the porting.

Of course you have to install Code::Blocks with MSVC2010 too.

EDIT: The OpenGL library is supported by MSVC2010 and libsdl has VC development libraries. However, things seem to be more complex with Lua. My guess is that you might start a substantial porting work here.

这篇关于从Code :: Blocks移植到Visual Studio 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 03:23