Skip to content

Commit

Permalink
Fix multiple definition errors with GCC>=10.1.0 by seperating definit…
Browse files Browse the repository at this point in the history
…ions from declarations
  • Loading branch information
markjolah committed Jul 16, 2020
1 parent c8a0245 commit 893b2de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project (PIOC C)
add_library (pioc topology.c pio_file.c pioc_support.c pio_lists.c
pioc.c pioc_sc.c pio_spmd.c pio_rearrange.c pio_nc4.c bget.c
pio_nc.c pio_put_nc.c pio_get_nc.c pio_getput_int.c pio_msg.c
pio_darray.c pio_darray_int.c pio_get_vard.c pio_put_vard.c)
pio_darray.c pio_darray_int.c pio_get_vard.c pio_put_vard.c pio_error.c)

# set up include-directories
include_directories(
Expand Down
21 changes: 21 additions & 0 deletions src/clib/pio_error.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @file
* Definition for Macros to handle errors in tests or libray code.
* @author Ed Hartnett
* @date 2020
*
* @see https://github.com/NCAR/ParallelIO
*/

/**
* Global err buffer for MPI. When there is an MPI error, this buffer
* is used to store the error message that is associated with the MPI
* error.
*/
char err_buffer[MPI_MAX_ERROR_STRING];

/**
* This is the length of the most recent MPI error message, stored
* int the global error string.
*/
int resultlen;
4 changes: 2 additions & 2 deletions src/clib/pio_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@
* is used to store the error message that is associated with the MPI
* error.
*/
char err_buffer[MPI_MAX_ERROR_STRING];
extern char err_buffer[MPI_MAX_ERROR_STRING];

/**
* This is the length of the most recent MPI error message, stored
* int the global error string.
*/
int resultlen;
extern int resultlen;

#endif /* __PIO_ERROR__ */

0 comments on commit 893b2de

Please sign in to comment.