简体   繁体   中英

How to compile a visual studio c++ project on linux efficiently

I'm having a C++ Project in Visual Studio 2017 which uses curl. It compiles fine on a linux machine. But i think my procedure is not efficient. Im just copying my source files to the linux machine and run

g++ one.cpp two.cpp etc.cpp -lcurl

or even

g++ *.cpp -lcurl -o output

Is there something to do this a "cool" way? Like cmake or something (sorry im not into this). An Example would be really helpful

Your options range wildly from:

  • Just keep doing what you're doing
  • Wrap that command in a shell script so you don't have to keep typing it
  • Make a Makefile to auto-generate that command
  • Use CMake to auto-generate the Makefile (or automake or something else)
  • Use an IDE (examples for various platforms: Eclipse , Xcode , Visual Studio ) to fully manage the project for you, including build rules/commands — Visual Studio Code in particular may be of interest here

It is completely up to you what you pick.

Personally, in your situation, right now I'd just throw together a Makefile and be done with it, until your needs become more complex.

Whichever of the latter 3 options you pick, there are abundant examples online and in your book already.

I would say, please don't use a really complicated solution to solve a simple problem just because it's "cool", because that's not what cool is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM