Mac vs. Ubuntu for C/C++ development? [closed] - c++

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm looking to buy a personal machine for development and I'm deciding whether to go with a Mac or a PC (on which I'd run Ubuntu). My plans for the next year or so involve getting more heavily into C/C++ and networking than I currently am. Are there any differences I should be aware of between the two OSes as far as C/C++ system libraries and such go?

If you have a lot of excess cash laying around, get the mac with the option to run Ubuntu in a VM. Otherwise a pc gives just about as much flexibility. As far as the actual development environment, both are going to be similarly good, but Ubuntu might be just a bit more developer friendly: apt certainly does make it easy to get additional libraries, etc. It might also depend on what IDE or tool chain you want to use.

Get a mac and run ubuntu in VMware or Virtual Box.
This is what I do and it works a treat.
You can even have 32bit and 64bit ubuntu. -- I've recently had issues that only shows up on 32bit or 64bit compilers.

A Mac is an excellent option - many have already mentioned the ability to dual boot or run a Linux VM. Remember also that the Mac has its roots in UNIX under the hood, so you get lots of *nix goodies for free right out of the box. A number of my colleagues have purchased Macs intending to run another OS in a VM, and are later pleasantly surprised to find that OS X does what they need it to do.

It sounds like you are interested enough in Macs and technically minded enough to consider using Linux. In that case, I would recommend building your own Macintosh and dual-booting OS X with Ubuntu.
This gives you several advantages:
Choose your own hardware at a favourable price/performance ratio
Get access to things that real Macs do not, like PCI slots and serial/parrallel ports
Ability to run things like more than 2 monitors, multiple hard disks, maybe BluRay drives or SSDs

Related

Clear a specific place on the screen [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
clear a specific place on the Console by C++ 17 in vs2017, like this:
hello guys, I want to clear something, pls help me.
clear → want or clear → something else
Without refresh screen and using system("cls") or like these.
The C++11 standard (check some C++ reference site, then read the standard i.e. n3337) does not know about and does not mention screens. You can code C++ programs on computers without screens (e.g. web servers, embedded appliances, etc...), and notice that the standard output -e.g. std::cout - might not be a screen (think of redirections and pipelines), even on a laptop or desktop computer & OS (Windows, Linux, MacOSX, ...).
But many libraries might be useful to you. First, you can use OS specific libraries (e.g. WinAPI on Windows). You can also target a terminal emulator and use a library such as ncurses (or similar), and you might even output directly ANSI escape codes (I don't recommend this). And you could want to develop a GUI application with toolkits like Qt. You might even want to code a Web application (using HTTP server libraries like Wt or libonion, with more code in Javascript & HTML5).
I mentioned a few libraries, but you could find a lot more.
Be aware that terminals (and their emulators) are complex devices and their OS support is chaotic (for historical reasons). For POSIX and Unix read the Tty Demystified and see also termios(3). Have a glance at them even if you are using Windows, to feel how complex terminal emulators have to be.
In a comment, you mention "mouse". They are not known to the C++11 standard. My feeling is that an application handling the mouse should preferably provide a GUI (even if you could code a terminal application using the mouse thru other libraries or OS specific code), so I would recommend Qt (however, you might use some other GUI toolkit).

Is it possible to make C++ platform independent by making it run inside a VM just like in Java? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Given that Java is highly portable and it is not having serious overheads, can't C++ be made platform independent?
Yes, it is perfectly possible. For example, you can compile C++ to JavaScript ( see https://softwareengineering.stackexchange.com/questions/197940/how-to-run-c-code-in-browser-using-asm-js ) or to CLI byte code ( https://en.wikipedia.org/wiki/C%2B%2B/CLI ) to run on Windows or Linux, or various other targets.
None of these currently performs as well as native C++, and most lack direct access to operating system resources. So the portability comes at some cost, and usually if you wanted to pay the cost of targeting web browsers or CLI, you have languages better suited to those platforms.
In reality, the method of code execution (whether the code is compiled, interpreted, run by VM, etc) is more a property of the implementation, and not the language.
when people say C++ is a compiled language and that JavaScript is an interpreted language, that does not necessarily mean that you can't write a compiler that translates JavaScript code to machine code on your hardware of choice, but rather what is a common way to provide implementation for said language.
In practice, C++ is used because of its efficiency and close to the metal features that is a good choice for performance critical tasks like embedded systems programming, systems programming, graphics, etc, so getting C++ to run in a VM would defeat its purpose.
kinda like buying a fillet Mignon and cooking it in the microwave.
Java compiles to an intermediate platform-independent byte code that is then interpreted at runtime by platform-specific JVMs. That is what allows Java to be portable. Each type of JVM is tailored to run the byte code on the platform's particular hardware architecture.
C/C++ compiles to native machine code that runs directly on the CPU (or as directly as the OS will allow). So no, you cannot compile C/C++ in a platform-independent manner. You have to use platform-specific compilers to compile C/C++ code for each hardware architecture that you want to run your code on.

distcc like framework for Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
We are running some heavy computations that can take a lot of time (even days). We have an architecture similar to that of a compiler (compiler + linker):
many blocks of data that need to be computed (they are computed by a solver.exe executable) - similar to a compiler
a gatherer application that combines all the results into the final form - similar to a linker
What I saw is that distcc does the distribution over the network quite nicely. Unfortunately distcc works under unix environment.
Is there a platform that can provide something similar to what distcc does, but under Windows (7+) platform?
LATER EDIT: Added C++ tag because if such framework exists we would benefit from our C++ coding experience.
I don't know of any free/open source solutions for Windows, but there are two commercial offerings which may help:
ElectricAccelerator from Electric Cloud. ElectricAccelerator was originally designed to accelerate software builds, but can distribute arbitrary processes to a network of computers for execution in parallel. Based on what you've said, it should be straightforward to use Accelerator for your needs. It is available on both Linux and Windows.
Xoreax Incredibuild was also originally designed to accelerate software builds, but like Accelerator, Incredibuild can distribute arbitrary processes. It is available only on Windows.
Disclaimer: I am the architect of ElectricAccelerator
FastBuild is free and opensource. It is available for Windows/Linux/OSX. It has its own language for build config files. You can setup workers on local network and a client that connects to workers and delivers work to them. FastBuild works for C++ and should probably work for any language, as you can setup any compiler executable and dependencies (compiler is distributed to workers, so that you don't need to setup compiler on every machine). The only drawback that I found is that in order to connect workers with clients you need to setup a Windows network share with writable folder, I think that's very inconvenient way to setup a build cluster, a better way would be to write a config with list of servers, maybe it will be fixed in the future. Also FastBuild cluster can be run only on local network, would be great to be possible to setup many computers though internet, it shouldn't be difficult to implement, also internet connection should be encrypted to secure secret sources.

VMWare equivalent [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I need to do testing on clean machines frequently so I need some kind of virtual machine emulator which can load and run clean OS images.
Do you know any recommended freeware or low cost emulator?
I have been using VirtualBox for a while - http://www.virtualbox.org/ - and it works a treat
Everyone seems to be suggesting VirtualBox but, in my opinion, you can't beat VMWare at the virtualization game.
I would get a copy of VMWare Player (it's free for non-commercial use and you'd be hard pressed to find one cheaper than that), then use this web site here to create yourself a virtual machine to whatever specification you need.
I run heaps of images under XP (and one XP image under Debian) and it really is easy to set up. Early editions of the Linux VMWare required you to re-configure the software whenever the kernel changed but this is now an automatic process.
Free emulator for Linux:
QEmu and KVM
http://www.qemu.org/
Best I have used.
We're using Xen paravirtualization, and it's working very well. It's the same technology used by Amazon's Elastic Compute Cloud (EC2) to run your virtual machine images on their physical hosts. It only costs you 0.5-3.0% of your CPU cycles too.
What exactly are your needs?
I would try Vagrant which uses VirtualBox. It makes it really easy and quick to create and destroy boxes as you need them.
I've found it to be really amazing for getting a new clean development environment up and running. Once you get it going it makes switching, testing, creating, sharing and trashing development environments real easy.
VirtualBox
VirtualBox
VirtualBox is a powerful x86
virtualization product for enterprise
as well as home use. Not only is
VirtualBox an extremely feature rich,
high performance product for
enterprise customers, it is also the
only professional solution that is
freely available as Open Source
Software under the terms of the GNU
General Public License (GPL).
VirtualBox is also a good alternative.
I realize this has been well-answered already, but I'd like to add a couple of notes about VirtualBox: (1) In my experience, it is much faster than VMware when running as a Linux host, and (2) the snapshot features have been greatly improved in recent versions (the comprehensive snapshot functionality is what kept me in VMware for a long time.)
VirtualBox is a great virtual machine solution.
I'm a big fan of VirtualBox as well. The OSE is free and runs really well.
VMWare is nice because it's incredibly robust, especially the server edition. With the server edition, you can run all off your VM's of one machine and access them at any time by browsing to VMWare's web GUI. This is a nice feature that I've used time and time again.
I would say that if you're doing just testing/playing around, I'd go with VirtualBox over VMWare.

What book or online resource do you suggest to learn programming C++ in Linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have years of C++ programming experience in Windows. Now I need to program some applications for Linux. Is there any resource that helps me quickly get the required information about Linux technologies available to C++ developers?
Programming in C++ under Linux isn't all that different at the core. Linux compilers are generally more standard's conforming than MSVC; however, that is changing as MSVC is becoming a better compiler. The difference is more from the environment and available libraries. Visual Studio isn't available (obviously) but some other environments like Visual SlickEdit and Eclipse are available on both.
The build system is widely varied and will probably be dictated by your preference between Gnome, KDE, or the ever-present command line. Personally, I find the latter to be the cleanest and most consistent. If you end up at the command line, then learn GNU Make and pick up a copy of GNU Autoconf, Automake, and Libtool. This will introduce the GNU command line development stack pretty nicely.
Debugging is a lot different being that VS provides a nice GUI debugging environment. Most Linux environments simply wrap a command line debugger (usually gdb) with a GUI. The result is less than satisfactory if you expect a nicely integrated debugger. I would recommend getting comfortable with gdb. There are some decent tutorials for gdb online. Just google for a bunch of them. Once you get a little comfortable, read the online manual for the really neat stuff.
The other choice is to use whatever development environment is packaged with your windowing system or to use something like Eclipse and some C++ plug-in
As for books on the subject, Advanced Programming in the UNIX Environment is a must-read. UNIX Systems Programming is also a good read since it gives you a solid grounding in shells, processes, and what not. I would recommend both the POSIX Programmer's Guide and POSIX.4 Programmer's Guide since they give you a lot of the systems programming stuff.
With all of that said, enjoy your foray into an operating system that really cater to programmers ;)
I'm in the process of making the switch from Windows to Linux right now for a program and so far I have found that man and grep are great. Instead of looking up function prototypes in MSDN (or similar) I just use man.
If I need a code example, greping through an existing project that has some similarities to mine is a great help. Or if there is a project similar enough to warrant this, setting up an LXR of their code-base to more easily facilitate reading really helps a lot.
In general, the open source nature of Linux has been the greatest resource to learning to program on Linux.
Also Stevens' Advanced Programming in the UNIX Environment was a huge boon. But as for IDE's and the like, call me a luddite, but I just like vim and make.
I've learned a lot from Beginning Linux Programming by Matthew and Stones, though it's more C than C++.
I use die.net and lookup at The Open Group's website a lot, http://www.opengroup.org/onlinepubs/000095399/functions/{function}.html. They have much the same information as man. I use SciTE, and have the C API and The Open Group POSIX lookup as hotkeys, as described here.