需要将MS Visual C ++移植到Linux G ++ [英] Need to port MS Visual C++ to Linux G++

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

问题描述

我首先要说我是计算生物学家,而不是软件工程师,所以我的编程知识仅限于科学计算(我使用C ++,Matlab和R).

I'd like to start by saying I am a computational biophysicist, not a software engineer, so my knowledge of programming is limited to scientific computation (I use C++, Matlab, and R).

最近我被要求从MS Visual C ++向Linux移植大量的代码包(约10,000行),在那里我一直在开发一些代码.他们知道我是用Linux编写的,直到大约一年后才告诉我他们希望将其与Windows中的旧代码集成.

I was recently asked to port a huge package of code (~10,000 lines) to Linux from MS Visual C++, where I've been developing some code. They knew I was writing in Linux and didn't tell me until nearly a year later that they wanted it integrated with old code in Windows.

说实话,我不知道从哪里开始.我能够将MakeFile放在一起并成功编译,但是遇到了分段错误,在valgrind调查之后,该错误可能与数百个管理不当的内存分配有关.我是否有一个很好的起点,不需要我学习MS Visual C ++就能在Linux上正常工作?任何帮助将不胜感激.谢谢!

To be honest, I have no idea where to start. I was able to put together a MakeFile and compile successfully, but I get a segmentation fault, which after investigation by valgrind, is probably related to the hundreds of mismanaged memory assignments. Is there a good place for me to start that doesn't require me to learn MS Visual C++ just to get this working in Linux? Any help would be greatly appreciated. Thanks!

谢谢您到目前为止提供的所有帮助.我绝对是真实"编程的新手,所以我甚至都不总是清楚我应该如何描述我的问题.感谢您的理解并提供了一些良好的起点.

Thanks for all the help so far. I'm definitely a newcomer to "real" programming so I'm not even always clear as to how I should describe my problem. Thanks for being understanding and providing some good starting points.

推荐答案

我将首先打开编译器警告并修复所有警告.

I would start by turning the compiler warnings on and fixing all warnings.

-Wall -Wextra -Wstrict-aliasing -pedantic -Werror -Wunreachable-code

如果修复所有警告,它将解决许多您可能从未见过的问题.尤其是在不同的编译器之间移植时(因为这些代表着由于不同的编译器可以做不同的事情而将影响移植的问题).

If you fix all the warning it will solve a lot of problems that you may never have seen. Especially when porting between different compilers (as these represents problems that will affect porting as different compilers can do different things).

在MS编译器上时.将警告级别提高到4,并告诉编译器将所有警告视为错误.这些的结合会得到很多错误.

When on MS compiler. Turn the warning level upto 4 and tell the compiler to treat all warnings as errors. The combination of these will get a lot of errors.

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

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