You need to connect MS Visual C ++ to Linux g ++

I would like to start with the fact that I am a computational biophysicist and not a software engineer, so my programming knowledge is limited to scientific computing (I use C ++, Matlab and R).

Recently, I was asked to port a huge package of code (~ 10,000 lines) to Linux from MS Visual C ++, where I developed some code. They knew that I was writing in Linux and did not tell me almost a year later that they wanted it to be integrated with old code in Windows.

Honestly, I have no idea where to start. I managed to compile the MakeFile and compile it successfully, but I get a segmentation error, which, after examining valgrind, is probably related to hundreds of incorrect memory assignments. Is there a good place for me to start, which does not require me to learn MS Visual C ++ in order for this to work on Linux? Any help would be greatly appreciated. Thanks!

EDIT: Thanks for all the help so far. I am definitely new to "real" programming, so I don’t always understand how I should describe my problem. Thank you for understanding and providing good starting points.

+4
source share
2 answers

I would start by turning on compiler warnings and removing all warnings.

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

If you fix the entire warning, it will solve many problems that you may never have seen. Especially when porting between different compilers (since they present problems that will affect porting, because different compilers can do different things).

When on the MS compiler. Turn the warning level to 4 and tell the compiler that all warnings will be treated as errors. The combination of these errors will have many errors.

+9
source

Given this code size, if you start by fixing the RAM management issues that you have already noticed, you will soon have a working application. This assumes that you are correctly diagnosing each segfault, which is not very obvious from the question. The process of learning what exactly the new code does and how it will go hand in hand with the debugging process.

If it already compiles on Linux, you won’t need to find out about any other operating systems, assuming that you didn’t “comment out” any code that you did not understand when trying to get it to work, or otherwise avoided referencing Individual Windows libraries that could play a role in the application.

+3
source

All Articles