Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple definitions #955

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vic/drivers/cesm/src/vic_cesm_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* These routine handles the startup tasks for the CESM driver.
*****************************************************************************/

#define _MAIN_
#include <ctype.h> // Do we need this line?
#include <vic_driver_cesm.h>

Expand Down
1 change: 1 addition & 0 deletions vic/drivers/classic/src/vic_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Classic driver of the VIC model
*****************************************************************************/

#define _MAIN_
#include <vic_driver_classic.h>

// global variables
Expand Down
1 change: 1 addition & 0 deletions vic/drivers/image/src/vic_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Stand-alone image mode driver of the VIC model
*****************************************************************************/

#define _MAIN_
#include <vic_driver_image.h>
#include <rout.h> // Routing routine (extension)

Expand Down
1 change: 1 addition & 0 deletions vic/drivers/python/src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* level.
*****************************************************************************/

#define _MAIN_
#include <vic_driver_python.h>

// global variables
Expand Down
8 changes: 7 additions & 1 deletion vic/vic_run/include/vic_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@
#define min(a, b) (a < b) ? a : b
#define max(a, b) (a > b) ? a : b

#ifdef _MAIN_
#define GLOBAL
#else
#define GLOBAL extern
#endif

extern size_t NR; /**< array index for force struct that indicates
the model step avarage or sum */
extern size_t NF; /**< array index loop counter limit for force
struct that indicates the SNOW_STEP values */
char vic_run_ref_str[MAXSTRING];
GLOBAL char vic_run_ref_str[MAXSTRING];

/******************************************************************************
* @brief Snow Density parametrizations
Expand Down
8 changes: 7 additions & 1 deletion vic/vic_run/include/vic_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@
#define LOG_LVL 25
#endif

FILE *LOG_DEST;
#ifdef _MAIN_
#define GLOBAL
#else
#define GLOBAL extern
#endif

GLOBAL FILE *LOG_DEST;

void finalize_logging(void);
void get_logname(const char *path, int id, char *filename);
Expand Down
8 changes: 7 additions & 1 deletion vic/vic_run/include/vic_run.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

#include <vic_def.h>

#ifdef _MAIN_
#define GLOBAL
#else
#define GLOBAL extern
#endif

void advect_carbon_storage(double, double, lake_var_struct *,
cell_data_struct *);
void advect_snow_storage(double, double, double, snow_data_struct *);
Expand Down Expand Up @@ -154,7 +160,7 @@ double func_atmos_energy_bal(double, va_list);
double func_atmos_moist_bal(double, va_list);
double func_canopy_energy_bal(double, va_list);
double func_surf_energy_bal(double, va_list);
double (*funcd)(double z, double es, double Wind, double AirDens, double ZO,
GLOBAL double (*funcd)(double z, double es, double Wind, double AirDens, double ZO,
double EactAir, double F, double hsalt, double phi_r,
double ushear,
double Zrh);
Expand Down