CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   "unresolved external symbol" (https://www.cfd-online.com/Forums/fluent/84366-unresolved-external-symbol.html)

coiby January 27, 2011 04:45

[solved]"unresolved external symbol"
 
I've fixed the problem. Thanks!

I write a proram for the purpose of user-defined initialization. But Fluent gives the error message when compiling it. Can anybody figure out the reason? Thanks!
Quote:

# Generating udf_names.c because of makefile my_init_func.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj my_init_func.obj
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Creating library libudf.lib and object libudf.exp
my_init_func.obj : error LNK2001: unresolved external symbol _ran
libudf.dll : fatal error LNK1120: 1 unresolved externals
Code:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<udf.h>
#include<math.h>
#define K 4 //K nucleis per cell
#define mu 2.6 //expected value
#define sigma 8.0 // standard deviation
#define PI 3.1416926
#define maxi 10000000
float gauss(void)
{
 float tmp; //tmp value
 float u;
 float v;
 //float mu; // the expected value of Gauss Distrubution
 tmp=0;
 srand((unsigned)time(NULL));
 
 while(mu-2>tmp||tmp>mu+2){
  u=ran()*1.0/RAND_MAX;
  v=ran()*1.0/RAND_MAX;
  tmp=sqrt(-2*log(u))*cos(2*PI*v)*sigma+mu;
 }
 return tmp;
}
DEFINE_INIT(my_init_function, domain)
{
 cell_t c;
 Thread *t;
 int i; //loop control
 int j; //loop control
 //int cnum = domain->cell_count; // the total number of cells
 float *radius[maxi][K];
 j=0;
 thread_loop_c(t,domain)
 {
  for(i=0;i<K;i++)
  *radius[j][i]=gauss();
  j++;
 }
}



All times are GMT -4. The time now is 02:46.