CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

error LNK2019 : Unresolved external symbol

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2017, 06:52
Unhappy error LNK2019 : Unresolved external symbol
  #1
New Member
 
MEKSEM HOCINE
Join Date: Mar 2017
Posts: 5
Rep Power: 9
MEKSEM is on a distinguished road
hy all, i'am traying to compile a UDF who give me the average pressure and temperature of air in compressible tow-phase flow (air-water) liquid piston.

but when i compile my udf, it given to me this error that i never seen before

error LNK2019 : Unresolved external symbol __imp__RP_Get_Float Referenced in the Pressure function

error LNK2019 : Unresolved external symbo __imp__Get_Domain Referenced in the Pressure function



I implore you to help me

i attached my UDF :
Attached Files
File Type: c udf.c (968 Bytes, 34 views)
MEKSEM is offline   Reply With Quote

Old   June 19, 2017, 08:02
Default
  #2
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
Can you just copy+paste the code to this page?

I don't want to download any unknown files.
KaLium is offline   Reply With Quote

Old   June 19, 2017, 08:05
Default
  #3
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
are you using functions such as sin()?

Have you included the #math?
KaLium is offline   Reply With Quote

Old   June 19, 2017, 09:12
Default
  #4
New Member
 
MEKSEM HOCINE
Join Date: Mar 2017
Posts: 5
Rep Power: 9
MEKSEM is on a distinguished road
hy, KaLium

Here is my udf

________________________________
#include "udf.h"



DEFINE_EXECUTE_AT_END(Pression)
{

Domain *subdomain;
Domain *mixture_domain;
int phase_domain_index;
cell_t c;
Thread *t;

real sum_p = 0., sum_T = 0., P_moy, T_moy, vol_tot = 0;
FILE* fichier = NULL;

fichier = fopen("data_air.txt", "a");
mixture_domain = Get_Domain(2);
subdomain = Get_Domain(2);

sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{


thread_loop_c(t,subdomain)
{
begin_c_loop_all(c, t)
{


vol_tot += C_VOLUME(c, t);
sum_p += C_P(c, t);
sum_T += C_T(c, t);

end_c_loop(c, t)
}
}

P_moy = sum_p / vol_tot;
T_moy = sum_T / vol_tot;

C_UDMI(c, t, 0) = P_moy;
C_UDMI(c, t, 1) = T_moy;




printf("P_moy_air: %g\n", P_moy);
printf("P_moy_air: %g\n", T_moy);


if (fichier != NULL)
{
fprintf(fichier, "%g %g\n", CURRENT_TIME, P_moy, T_moy);
fclose(fichier);
}
fflush(stdout);
}
}
MEKSEM is offline   Reply With Quote

Old   June 19, 2017, 09:19
Default
  #5
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
Are you sure that you can use
C_UDMI(c, t, 0) = P_moy;
C_UDMI(c, t, 1) = T_moy;
outside of the cell-loop?

Does you code even need them?
KaLium is offline   Reply With Quote

Old   June 19, 2017, 09:27
Default
  #6
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
in fprintf(fichier, "%g %g\n", CURRENT_TIME, P_moy, T_moy); you are defining only 2 variables, but trying to use 3.
KaLium is offline   Reply With Quote

Old   June 19, 2017, 09:52
Default
  #7
New Member
 
MEKSEM HOCINE
Join Date: Mar 2017
Posts: 5
Rep Power: 9
MEKSEM is on a distinguished road
thanks for your raplay , i'll tray to remind this.

but i already code the UDMI outside and it's run so good.

for the fprint, the Current_time doesn't need to be defined

i think that the problem Is due to compilation with Visual Studio but i can't see him
MEKSEM is offline   Reply With Quote

Old   July 23, 2021, 13:56
Default
  #8
New Member
 
tyehuo
Join Date: Nov 2019
Posts: 5
Rep Power: 6
tyehuo is on a distinguished road
kalium does not know what he is talking about.
That's not the point at all.
I have also encountered the same problem, not solved yet.
tyehuo is offline   Reply With Quote

Old   July 24, 2021, 00:40
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Kalium gave useful feedback. They identified two problems in the code.

There might be more problems remaining, but it's not nice to say such a bad thing about somebody who is helping.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   September 1, 2021, 10:20
Default did you find the solution for this problem? i have it too.
  #10
Member
 
Vivek MJ
Join Date: Oct 2020
Location: India
Posts: 53
Rep Power: 5
vivjk94 is on a distinguished road
The code below is my udf for simulating a gear pump:

for second gear,

#include "udf.h"

DEFINE_CG_MOTION(gear_2_new,dt,vel,omega,time,dtim e)
{


real t = CURRENT_TIME;
NV_S (vel, = , 0.0);
NV_S (omega, = , 0.0);
omega[2] = -60.0;


}

for first gear,

#include "udf.h"

DEFINE_CG_MOTION(gear_1_new,dt,vel,omega,time,dtim e)
{

real t = CURRENT_TIME;
NV_S (vel, = , 0.0);
NV_S (omega, = , 0.0);
omega[2] = 60.0;

}


This is the error message i recieve:
gearone.obj : error LNK2019: unresolved external symbol __imp__RP_Get_Float referenced in function _gear_1_new
geartwo.obj : error LNK2001: unresolved external symbol __imp__RP_Get_Float
C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0\mult iport\win64\mpi\shared\mport.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0\win6 4\2d_node\fl_mpi1920.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
libudf.dll : fatal error LNK1120: 1 unresolved externals

The weird thing about this is that this udf executed perfectly the previous day and today its throwing me this error. i use fluent 19.2 and Visual studio 2017 .
Need suggestions
vivjk94 is offline   Reply With Quote

Old   September 2, 2021, 04:51
Default
  #11
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
most likely you are using x64 fluent version, but run x86 compiler
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CGNS Compiling Diego Main CFD Forum 17 December 21, 2014 01:40
using METIS functions in fortran dokeun Main CFD Forum 7 January 29, 2013 04:06
OpenFOAM install on Ubuntu Natty 11.04 bkubicek OpenFOAM 13 May 26, 2011 05:48
POSDAT problem piotka STAR-CD 4 June 12, 2009 08:43
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


All times are GMT -4. The time now is 08:11.