C++ OSX Setup w/ Vs Code or? - c++

I have to use c++ 11 for class and I was wondering how I go about setting that up on a MAC? I need to be sure it is specifically c++ 11 or I will fail.
I liked the themes in VS Code and would like to do it with this program, but I am open to suggestions.

One answer would be to use Xcode, but personally I use Atom as my text editor and have several different compilers installed.
You will most likely need to install Xcode just for the build tools that come with it. You could install GCC or Clang via Homebrew or a package manager of your choice.(Yyou will need a working C++ compiler to install Gcc or clang via homebrew)
My suggested course of action would be to:
Install Xcode (From Mac App Store)
Install Homebrew(optional)
Install GCC and or Clang (optional)
Install a text editor like Atom or VSCode
The latest versions of GCC, Clang And Apples LLVM compiler will be able to compile C++11 and C++14.
If you choose to go with Atom, VSCode, etc... you will need to learn how to compile from the command line or use Make(Which is what I usually do)
It sounds to me like you go to a school that uses MS Visual Studio and you are seeking a replacement? If so you may run into trouble down the line not having Visual Studio. If your courses are going to be using Visual Studio I might suggest Dual Booting your Mac with Windows and Installing Visual Studio on there.(Though you will need copies of each, but your school may provide. Mine did) That is how I got through most of my programming classes that depended on Visual Studio.
EDIT:
Additionally you will need to make sure that you have make installed on your system. Try running make -v from your terminal. If you get command not found you will need to install it, it comes with Xcode or you can install it via Homebrew.

Related

What is an easy way to install a unix terminal with a C++ mingw compiler?

I'm going to teach students to use SFML with C++, and I'm afraid the school doesn't have visual studio C++ installed, or will be a bit heavy to use for those students.
I want to have a plan B and have the option of a simple makefile that I can build on windows with SFML.
https://www.sfml-dev.org/download/sfml/2.5.1/ this page offers binaries compiled with different, specific versions of mingw with their respective mingw package links, unfortunately mingw doesn't include an unix terminal, like the one included with git-bash, so I can run a makefile.
What are the steps required to have a problem unix terminal, running in windows, minsys, msys2 or not, that can work well with those mingw packages? I have trouble finding help or proper instructions.
You want https://www.msys2.org/
It provides bash terminal and already contains mingw compiler. Perhaps it even has SFML packages already.

Difference between the windows installation of minGW64 and the MSYS2 shell installed version of minGW64

I have been using the minGW64 compiler with Visual studio code on windows for some time. However, there are certain limitations to it when it comes to certain libraries. The absence of a make tool and the inability to execute a config script while compiling a c++ program being the main ones. I came to know of MSYS, a tool provides a UNIX environment that allows us to do certain things that are forbidden by the windows terminal. I installed it but I saw that I need to install mingw64 again, from within the terminal to use it with MSYS2.
My question is, is there no way I can use my earlier mingw copy with this installation of MSYS2? Is there some difference between the mingw64 that comes with MSYS2 and the standard installation?

GCC x64 on Windows

I tried installing CygWin64, but I cannot find any executables to build my code with in the C:\cygwin64 directory created.
I tried Win-Builds but the setup doesn't load with any mirror I give it. It tries to connect 3 times then aborts.
I tried MinGW-W64-Builds, but I cannot figure out how to install it. I can see a .sh file there, but I believe that is for Linux, so I do not know why because it says it is for Windows
Is there even a way to use 64-bit GCC on Windows? I am trying to tie it to a Code::Blocks IDE as that one only comes with the 32-bit version of MinGW.
Check out out the MinGW-w64 + GCC personal build at http://winlibs.com/.
No installation required, just unzip.
Examples on how to use are on the site, including on how to integrate with Code::Blocks IDE.

How to build and install GCC on Windows 7, ver. 4.8.1

I would like to upgrade my old GCC compiler to v. 4.8.1.
Currently I'm using Code::Blocks IDE (nightly build, svn 8982), and my compiler is GCC 4.4.1.
I downloaded fresh GCC from their site - gcc.gnu.org
From what I've read in documentation, they say that I should first build compiler by myself. Afterwards, they throw something like this:
% mkdir objdir
% cd objdir
% srcdir/configure [options] [target]
However, I completly have no idea what to do with these lines.
And even if I did, afterwards come maaany lines with some additional options, where I am even more lost then before.
I don't know if there is any easy way of installing it, but from what I've read here, I can download MSYS from MinGW and it will do everything(I hope?) for me. However, from what I see there, it says that MinGW comes with already built version of GCC, meaning I won't be able to use mine anyway. Am I right? If yes, what should I do to build and use GCC? If not, then will I be able to easily install GCC after downloading MSYS?
Thanks in advance.
I can download MSYS from MinGW
YOu can.
and it will do everything(I hope?) for me.
It won't. MSys provides environment for building software that requires unix-like environment. To be more precise - autotools. If you aren't familiar with *nix build process (configure script), Mingw won't really help you.
However, from what I see there, it says that MinGW comes with already built version of GCC,
Yes, version 4.7.2 at the moment.
meaning I won't be able to use mine anyway. Am I right?
No. If you don't add Mingw/MSys to your PATH, you can keep multiple different installations on the same machine. It also SHOULD be possible to use multiple different versions of gcc within the same installation of mingw, but things can get messy here. (gcc3 and gcc4 should be able to exist, not sure about 4.7.2 and 4.8.1)
If yes, what should I do to build and use GCC?
You should search for precompiled binaries provided by somebody else. Compiling gcc yourself is possible, but for you (i.e. if you aren't arleady familiar with msys) it might not be worth the effort.
Either you could try http://mingw-w64.sourceforge.net/ or mingw-nuwen. Mingw provided by nuwen is 32bit only, but is very easy to install. The problem is that standard mingw distribution includes update tool (with "mingw uppdate" and "mingw upgrade" you can upgrade installed packages to their latest version), bug "mingw-nuwen" doesn't have such tool.
Because you say
However, I completly have no idea what to do with these lines.
You should either use precompiled mingw provded by somebody else, or use another compiler. If you don't really need bleeding-edge C++11 support ON WINDOWS, use visual studio express.

Eclipse Ganymede and MinGW in Windows

I'm trying to get eclipse to work with MinGW.
I've done the following:
Downloaded CDT for eclipse.
Installed MinGW.
Added C:\MinGW\bin to my path.
Opening a command prompt (CMD) and typing g++ or alike works fine.
I run eclipse, create a "New C++ Project", and only get the option saying "other toolchains".
There's a MILLION tutorials out there saying eclipse should identify MinGW on its own. It doesn't, and I don't know what to do. I've tried reinstalling everying in just about every order posible. Still no luck.
I've also noted some tutorials say something about creating a "Managed C++ Project". I've no such option, all I get is "C++ Project" and "C Project"
edit:
I have eclipse ganymede, windows x86_64, version 3.4.2
http://download.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/index.php
Running the "Eclipse IDE for C/C++ developers" fails, since there's no x64 version for windows. The x86 version requires x86 JAVA installed as well, and installing two versions of java, gave nothing but trouble in the past.
The instructions for setting up MinGW in Ganymede are located here.
The following are instructions and
links on how to install the current
version of MinGW. Note that these
links may become inaccurate over time
as new versions of MinGW components
are introduced. Please check the MinGW
File Release section for the latest
versions.
Download and run the MinGW setup program, MinGW-5.1.3.exe.
Select download and install the MinGW base tools and the g++ compiler.
You may select the Current or
Candidate version of these tools. You
may also install any of the other
available compilers as well.
Do not install the MinGW Make feature as the MSYS version of make
from step 5 is a more complete
implementation of make.
The MinGW setup program currently does not install the gdb
debugger. To install the debugger,
download the file from the following
location: gdb-6.6.tar.bz2
Extract the contents of the file gdb-6.6.tar.bz2 to the same location
where you installed MinGW.
If you want to use Makefile projects, download and run the setup
program from the following location:
MSYS-1.0.10.exe. MSYS provides an
implementation of make and related
command line tools. This is not
required for other types of projects
with the MinGW toolchain, which use
CDT's internal build tools to perform
the build.
Following this process resolved any problems I had.
I had the same exact problem with Eclipse Galileo and CDT 6.0.1. It turns out that CDT only recognized MinGW when it's located under c:\mingw. I had it in c:\msys\mingw so that was the problem. After I changed that everything worked fine.
The distinction between managed make projects and makefile project was removed in CDT 4.x, I think. Now there is only one type of project, but you can select different builders. CDT includes an internal builder which does not use makefiles and another one which does.
First, save yourself the effort of "reinstalling in every order possible". That is also known as trial-and-error, and will only make you more frustrated. Apply the normal problem-solving skills you have as a programmer.
Given that you have MinGW installed, what happens if you download "Eclipse IDE for C/C++ developers", start eclipse.exe, and try to create a C++-project with a MinGW toolchain?
EDIT: remember: the key in getting help with problems like these is to produce a minimal example which fails. Also, it would help if you provided URLs to the packages you installed (MinGW, Eclipse, etc.).
EDIT: I just installed CDT using the Ganymede update site, downloaded and installed MinGW from here, and restarted Eclipse, and everything worked fine. I know that doesn't help you, but it does prove that the toolchain detection isn't completely broken. Something is weird on your side.
You could try Wascana Desktop Developer. Its a distribution of Eclipse CDT configured specifically for developing on Windows.
I had the same problem (i.e. Eclipse not finding MinGW on the PATH) after I removed some of the unused files/folders from MinGW. It was ~600 MB and I was tasked to trim it down before adding to source control. I got it down to a workable ~200 MB. When I tried to re-create an Eclipse workspace afterwards, MinGW disappeared from available toolchains. It reappeared after I put the original MinGW install on the path.
HTH