CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CONVERGE (https://www.cfd-online.com/Forums/converge/)
-   -   safe_malloc build error in user_spray_udf (https://www.cfd-online.com/Forums/converge/175607-safe_malloc-build-error-user_spray_udf.html)

kabil August 2, 2016 07:07

safe_malloc build error in user_spray_udf
 
Hi all

In user_spray_udf there are a couple of lines for memory allocation that keeps making build error. those lines are:

/// islam memory allocation check for a bug
vapor_mass_0=(double *)safe_malloc(num_parcel_species*sizeof(double));
vapor_mass=(double *)safe_malloc(num_parcel_species*sizeof(double));
local_species=(double *)safe_malloc(num_total_species*sizeof(double));
temp_boil=(PRECISION *)safe_malloc(num_parcel_species*sizeof(double));

The build error is:

Undefined symbols for architecture x86_64:
"safe_malloc(unsigned long)", referenced from:
user_spray_evap_cell(parcel_cell_definition*, double*, double*) in main.cpp.o

My solution was to swap "safe_malloc" with "malloc" and it worked.

is there another solution like adding a function in header files ??

Thanks in advance

SauravMitra August 2, 2016 11:10

Hi Kabil,

Make sure that you had taken care of the following :

1) All the header files are there in the UDF directory. Especially in your case, it looks like safe_prototypes.h might be missing.

2) user_dynamic_routines.c is there in the UDF directory.

3) The makefile for UDF refer to the respective object files for the C-routines you are compiling.

I am guessing one of the above is not taken care of, which leads to build error message. If that is not the case, please send your files to support@convergecfd.com to have a closer look at this.


Thanks


All times are GMT -4. The time now is 23:25.