Error: identifier “cout” is undefined

I ran across the following issue when trying to compile my AztecOO source code outside of Trilinous.

example/AztecOO/adapt_main.cpp(94): error: identifier "cout" is undefined
cout << comm << endl;
^
example/AztecOO/adapt_main.cpp(94): error: identifier "endl" is undefined
cout << comm << endl;
^
example/AztecOO/adapt_main.cpp(96): error: identifier "cerr" is undefined
if(argc != 2) cerr << "error: enter name of data file on command line" << endl;

Fix
The compiler doesn’t recognize that these methods come from the standard library. Therefore, I must tell it with the following commands:

using std::cout;
using std::endl;
using std::cerr;

Credit goes to http://stackoverflow.com/questions/13208547/the-includeiostream-exists-but-i-get-an-error-identifier-cout-is-undefine.

AztecOO: error: identifier “sswap_” is undefined

Error
I’ve been trying to compile the AztecOO library outside of Trilinous. In doing so, I pulled the package Aztec source code from the Trilinous source code and opted to write my own Makefile to then compile it. My Makefile included the same settings reported in the Trilinous Makefile.export.AztecOO file.

To prepare this build, I needed to fetch the AztecOO_config.h file from a built version of Trilinous and place it in the source directory of the Aztec directory I was compiling (this file is generated upon ‘make’ in Trilinous). With that in place, I had the files I needed to compile Aztec, however, I ran into the following error.

error: identifier "sswap_" is undefined

Solution
SWAP_F77 is a defined module that points to the F77_BLAS_MANGLE module at the top of az_c_util.c. This second module is defined in AztecOO_config.h. All this module does, is add a “_” to the end of the name provided in the parameters and defines it with the provided value. This works when you are using the Fortran Blas library, but I am using the C version. To fix this, I edited all F77 functions in the AztecOO_config.h file to just return “name” instead of “name ## _”.

I also added this include statement to the file that errors src/az_c_util.c which required that I add –I to the compile statement in order for the compiler to find the right header files.

#include "mkl_blas.h"