Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Port GNU C++ programs to Visual C++

How do you port C++ programs with makefile made from GNU C++ in Linux to Visual C++?

like image 656
yoitsfrancis Avatar asked Jan 24 '23 18:01

yoitsfrancis


2 Answers

One thing I can suggest is to use CMake. If you implement your build system with CMake to auto-generate the makefiles for GCC on Linux, it takes only minor modifications to auto-generate projects and solutions for VC++.

Of course, this means learning a whole new build tool, so it may not be for you. It's only a suggestion.

like image 122
greyfade Avatar answered Feb 07 '23 07:02

greyfade


I don't know about an easy way to simply convert from one to another, but..

Assuming you use only ANSI C/C++ features, usually you don't need to convert the makefile, just look which .c/.cpp files are in it and add them to the VS project; you'll also have to check about compiler options and defined macros, to put them inside the VS project. I've done this to compile libs like expat, freetype, agg and others, without problems.

like image 30
Fabio Ceconello Avatar answered Feb 07 '23 08:02

Fabio Ceconello