Im running through some basic exercises in c++ and some of the structures are not allowed in c++98 mode. Is there anyway I can just set gcc to always compile in c++11 and not c++98. Right now I need to add the -std=c++11 flag in terminal. I read a previous post about using a Makefile. Adding a MakeFile for every directory im running these exercises in seems a bit tedious, is there anyway around that? Im a bit new to altering my compiler so any advice would be appreciated!
Im on a windows 10 machine using powershell at the moment.
Related
I am trying to set up vscode to do c++ programming on linux. I am confused about the instructions given. Do I need either one or both of these things given below to compile and debug my c++ code?
Can I use only cmake to compile run and debug my code? If so, do I still need the tasks.json and launch.json?
https://code.visualstudio.com/docs/cpp/config-linux
https://code.visualstudio.com/docs/cpp/cmake-linux
You can use cmake extension here.
Follow the setup instructions from here
I use it and it works perfectly.
I'm new to coding so please forgive me if I've asked something too obvious.
I'm trying to set up Visual Studio Code (Version 1.46.1) on my Mac running Catalina (10.15.4), and I want to build my C++ code using gcc. I understand that Mac uses Clang and since I want to get into Competitive Coding, I'd prefer if gcc was used in VSC when I build my code. How do I do that?
I've tried following the documentation as well as various YouTube videos but I can't find anything given in a simple structure. Also, I wanted to make sure that I was using C++ 17 and not any other version.
Thanks in advance!
I know there are a lot of answers, but no one is useful.
Ubuntu 16.04
Eclipse 4.6.2
I have tried every solution including:
Add -std=c++11 or c++14 or c++0x or gnu++0x or gnu++11 in the "Command to get compiler specs".
Add __GXX_EXPERIMENTAL_CXX0X in the "Symbols".
Add __cplusplus and set value to 201402L.
So I just wonder, why can't the developer just design an option to enable it?
Does any one have solution?
Oh am I forgot to rebuild? No.
To provide more information, I use a custom script to build my *.cpp. And I think build options won't affect the recognizance right?
Sorry about missing "11".
While your question is not very clear to me, I would like to recommend using eclipse-cdt
It comes as a plugin for eclipse. Please use the eclipse update manager to install this plugin and get started with your C++ development work.
I don't seem to be finding anything on this, or quite like this. I have this code that we want working with windows, so I've been using mingw and working to modify the code so it compiles. However, I ran into a big issue. The issue is entirely with Microsoft MPI. Our code includes and uses MPI for parallelization code. When the mingw compiler gets to the mpi portion, it tries to compile mpi.h and fails right away, because the overhead like (MPI_Offset and MPI_Count) are not declared in the header file (IIRC, they're usually done during compile time by mpicc or whatever, but MS-MPI doesn't do things that way, not really sure how it does things), it comes up with a bunch of "has not been declared" errors. How can I fix this? I really have no clue how MS-MPI works and the microsoft resources I've found do not help. I keep seein something about a cross platform mingw compiler, but I'm not sure what that is or how I'd use it. I have pretty much no experience compiling things outside of visual studio, and am only beginning to get familiar with mingw. Even pointers on where to look would be appreciated.
Interestingly enough, adding #include to the top of MS-MPI's mpi.h worked.
You may try mpich2. mpich2-v1.4.1p1 is the last version support windows officically. It also supports the MinGW and gfortran.
As stated in the mpich2's website, the msmpi is just a branch of mpich2 version 1.
I'm working on developing my own programming language, and to generate executables I wished to convert the source to C++ and the run it through a C++ compiler.
Does anybody know of a C++ compiler which I can simply include with my application and then invoke from the command line without installation?
I'm using Windows.
Thanks in advance, Tom.
Edit:
It seems gcc is the way to go and it would be a pain to set up, would people recommend bundling the installation file instead and then installing the compiler as part of the installation of my program?
Have you tried gcc (the windows port)?