将Visual Studio C ++移植到Linux [英] Port Visual Studio C++ to Linux

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

问题描述

我们有一个不是很复杂但很大(即很多文件)的Visual Studio C ++ Win32 Console,它是在VS2010中以C ++ 0x标准编写的.它不使用任何非标准代码或任何东西(希望如此!).

We have a not very complicated but big (i.e. lots of files) Visual Studio C++ Win32 Console written in C++0x standard in VS2010. It does not use any non standard code or anything (Hopefully!).

我现在想将其移植到Linux.最快的方法是哪种?autoconf?老式的make文件?还有其他解决方案吗?

I now wanna port it to Linux. Which way is the quickest way to do it? autoconf? old-fashioned make file? any other solution?

推荐答案

我会使用常规make,但要尽量使用默认规则来使其简单.继续添加依赖项.

I would use regular make but keep it simple with default rules as much as possible. Add in dependencies as you go along.

编辑:在过渡步骤中,请使用mingw进行构建,这样就可以避免整个API移植问题,直到您在新的构建机制中建立可用的构建为止.

As in interim step, build it with mingw so that you can avoid the whole API porting issue until you have a working build in your new build mechanism.

如果您的控制台应用程序调用win32 API函数,则可以在修改使用它的所有源代码或编写实现这些功能的模块之间进行选择.

If your console app calls win32 API functions then you have a choice between modifying all the source where it is used or writing a module that implements those functions.

在这种类型的先前移植工作中,我都尝试了两种方法,而后者更容易.我最终只写了大约18到20个匀场函数.

In prior porting efforts of this type I tried it both ways and the latter was easier. I ended up writing only about 18 to 20 shim functions.

它非常成功,最终我写了一个OS抽象层,该层被用于许多项目,这些项目使我可以在Windows本机,cygwin,Linux,VxWorks等上进行编译,而对一个或两个文件进行了细微的更改.

It was successful enough that I ended up writing an OS abstraction layer that was used on many projects that simply let me compile on Windows native, cygwin, Linux, VxWorks, etc. with trivial changes to one or two files.

(ps是否对基于C ++的OS抽象层的开放源代码版本感兴趣?如果有足够的兴趣,我想将其不受阻碍的版本发布给全世界.当BOOST太重(即嵌入式)时,这尤其有用项目.

(p.s. Any interest in an open source version of a C++ based OS abstraction layer? I was thinking of releasing an unencumbered version of it to the world if there's sufficient interest. It's mostly useful where BOOST is too heavy -- i.e. embedded projects.)

这篇关于将Visual Studio C ++移植到Linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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