13
donuts
7y

So looking to get started on c++ but have a noob question.

Is there a difference between c++ in Linux vs Visual Studio C++...

kinda don't want to install a Linux OS/cygwin to do it, takes too much space

Comments
  • 2
    The language is the same, but the bytecode produced is different. Tooling and pathing are the biggest differences; but it’s been a very long time.
  • 2
    @bkwilliams tooling and pathing, how so? a lot of libs dont work with VS C++?
  • 1
    @bkwilliams biggest question I guess is if I learn VS C++, can I easily switch to the Linux one or will it be like Python 2 vs 3, Angular vs AngularJS?
  • 2
    @billgates only the OS calls will differ wildly. But things like Boost http://boost.org/doc/libs/... have headers for both OSs.
  • 1
  • 2
    ...
    *cough* Win32 API/MFC (rofl) vs GTK+/QT (gtk - I mean ofc bindings, but what dumbass would be writing gtk apps in something but C/Vala)
    *another, longer, cough* but std is pretty much same
    *COUGH* also POSIX, but that's matters of C, not cpp
  • 1
    They are the same in that they implement the standard. For the most part you can learn VS C++ and/or Linux c++ and use them interchangeably, but you might need to recompile to use it in different environments. But vs can compile c++ to be cli(clr?) compliant which I don't believe works on Linux, but not sure much anymore.
  • 1
    @projektaquarius CLR programming is a different thing though. And no, Mono afaik doesn't support C++
  • 1
    From my experience, code working on Linux will always be working on VS. If you use the visual studio compiler you kinda have more freedom (you can interpret paths both with / or \ while linux compilers like g++ only interpret /) or for example you can have in the same class definition functions defined with their class namespaces (unnecessary): VS will automatically fix that in compiling while g++ will throw an error.

    I don't recall if Intel's compiler is closer to g++ or to vsxxx.

    So based on my experience if you learn to code the way g++ wants you to do you can just work on VS and be kinda assured it will work on Linux. I suggest looking into makefiles if you are not confident (which VS Can help you write) in order to have a quick way to compile and run it in a Linux environment for testing.
  • 2
    Simple answer: it's the same.

    The only thing that changes is OS specific calls. (Which for 90% of your learning you dont actually care about.)

    You can specify which compiler you want to use in visual studio... but there's no point unless you are developing cross platform.
  • 0
    pain... sufferring... anguish... and finally capitulation... :) for c++ on cygwin :)
  • 1
    Protip: Just use C and don't even bother with that bloated language.
  • 0
    @isaacWeisberg it is but visual studio has an option that will let your c++ run managed and compliant with the CLR.
Add Comment