errors caused due to migrating from ifort to gfortran - fortran

I had a code that was running perfectly on a machine uses ifort and mpif90
I tried to compile it again on another machine where gfortran is installed instead of ifort
I got errors like those
open(unit=10,name=oldfile,access='APPEND',
1
Error: Syntax error in OPEN statement at (1)
main.f
Does anyone knows how can i solve this?

access='append' is not standard fortran and gfortran does not support it. The ifort manual says what the exact meaning is. The equivalent standard conforming code would be access='sequential', position='append'.

I think the immediate error reported is actually caused by the
name=oldfile
that is an extension. Standard Fortran is
file=oldfile
The incorrect value for access will be checked later.
The overview of the possible specifiers in the openstatements for Intel Fortran is at https://software.intel.com/en-us/node/511247 The green ones are non-standard and will likely not work in other compilers (e.g., gfortran).

Related

emscripten C++11 with boost support issue

I have an issue when building my C++ project that uses boost in Emscripten as shown on the screenshot, it says that '_Atomic' is a C11 extension however even if i add -std=c++11 or even -std=c11 i am still getting the error, the _Atomic use is defined from boost.
any idea on how to work around on this? reading around it does say that C++11 is already supported in Emscripten.
my setup.
compiler: emscripten/em++ Clang 12.0.8
Why
The message in your screenshot shows:
you are compiling with clang
error: '_Atomic' is a C11 extension [-Werror,-Wc11-extensions]
So clang warns on c11 extensions because it has the diagnostic flag set, and is also configured to fail on warning which leads to your failed compilation.
-Wc11-extensions may have been specified directly in your compilation commands
or indirectly by -Wpedantic (see https://clang.llvm.org/docs/DiagnosticsReference.html#id604)
How to fix
You could specifically deactivate this warning with the -Wno-c11-extensions compiler flag, see this good explanation here on how to do it: https://nelkinda.com/blog/suppress-warnings-in-gcc-and-clang/

Possible issue when attempting to use an older gfortran 4.6 version compiler

When a .mod file isn't found by the compiler as in... " set_mod.mod isn't a GFORTRAN module file.." Is this a compiler or simply a remake issue of a new compiler onto a cluster??
The gfortran contributors try to maintain backwards compatibility of the module file format between different versions of the compiler. Unfortunately, there are situations where compatibility cannot be maintained. For example, the introduction of user-defined derived type IO caused an incompatibility, so the module file version number was bumped. Best practice would be to use the same compiler major version number to compile all code (e.g., 4.6.2 and 4.8.3 should be ok). If you jump to a new major version number, recompile everything.

C++11 support in NativeLibrary for Android

I'm trying to create a native library in C++, which I can use in Android.
I've created a project in Visual Studio 2017: Dynamic Shared Library (Android), and added my cpp code.
Though some of the code is running C++11, and I'd really like to keep it that way.
When I compile, I get the error:
This file requires compiler and library support for the ISO C++ 2011 standard.
This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
So I first tried going to Project->Properties->C/C++->Language->C++ Language Standard, and set the options as following:
'
When I compile now, I get exactly the same error. So I tried manually adding the -std=c++11 flag under additional options, though still getting the error.
Why is the compiler not willing to compile using the ++11 standard, and what can I do to fix this? I know it's experimental, but it should at least try to compile.
Best regards
The problem was solved, when I changed the settings to be for All Platforms, and not just ARM.

Is Fortran 77 supported by GNU gfortran?

I have come across a book which contains code written in Fortran 77. I wanted to compile and test some of them, and was wondering how well GNU gfortran supports legacy Fortran. I have Ubuntu 14.04 operating system.
Yes gfortran allows for fortran 77 see the docs standard compile options should work but may give warnings. you can set the flag
-std=legacy
to disable warnings that are caused from fortran77 features.

Run C++ Code Online?

Is there a website I can go to to run C++ code online? I have seen a few compilers, but is there one that can also receive input from cin? I want one that can basically host a C++ .exe online, and even more preferable is if it is like the VC++ platform.
You may want to give rextester a try. Currently g++ 4.7.2 with boost libraries and ability to supply compiler args.
Edit
Visual C++ is also supported now.
http://ideone.com/ Can compile several languages, and supports stdin
Yes, Ideone can do that. It's possible to specify stdin there.
Edit: Microsoft's online compiler seems to no longer be active :(
Microsoft research have made an online version of Visual C++ here: http://webcompiler.cloudapp.net/.
It (currently?) only compiles the code and does not run it so you won't be able to check cin though :(
Running code is now supported.
Currently the best online tools seem to be
Special Online Compilers
https://cppinsights.io shows, how C++ introduces conversions, etc. and interprets the source code (current clang based)
https://godbolt.org compare C++ compilers, show disassembly, run (many current compilers including Microsoft VCC and embedded compilers)
http://quick-bench.com create and compare benchmarks (current g++ and clang)
https://www.onlinegdb.com, includes gdb debugger (g++ 7.4.0)
Online Compilers that let you set compile flags
https://wandbox.org (current g++ and clang)
http://coliru.stacked-crooked.com (g++ 9.2.0)
https://repl.it/languages/cpp11 (clang 7.0.0)
https://www.tutorialspoint.com/compile_cpp11_online.php = codingground (g++ 7.1.1)
https://tio.run/#cpp-clang (g++ 8.3.1 and clang 7.0.1)
https://rextester.com/l/cpp_online_compiler_gcc (g++ 7.4.0, clang 6.0.0, VS C++ 2015 Update 1)
Online Compilers that do not let you set compile flags
https://www.jdoodle.com (g++ 9.2.0)
https://www.codechef.com/ide (g++ 9.1.0)
https://ideone.com (g++ 8.3.0 and clang 8.0.0)
https://paiza.io (clang 8.0.0)
https://www.codiva.io/c (clang 7.1.0)
https://code.labstack.com/cpp (g++ 8.3.0)
All listed compilers support C++17 code
Perhaps the following site is what you're aiming for: http://codepad.org/
There is Wandbox.org, which offers GCC and Clang to its latest versions (as of Nov 2018). It has stdin.
I wouldn't say it's a VC++ platform though.
TutorialsPoint's C++ Coding Ground lets you save and compile multiple source files at a time, which can be useful at times, and gives you a GNU bash console to play around with. It's not as convenient for sharing code as sites like Ideone, however.
[Note: While it only has links to C++, C++0x, and C++11 environments, you can compile code for C++14 by specifying the compiler option -std=c++1y. I'm not sure if it has any experimental C++17 support, however.]
repl.it can compile, run, and execute C++ and C++11. It's also interactive and you can ask for user input in realtime.