udf_names.c(7) : error C2059: syntax error : '}'
Dear All,
I just switched to windows7 64bit. I have Fluent 6.3.2 (64bit) installed on my PC with VisualC++2010 Pro RC. and the environment path variables set for VC++ and Fluent. For a test case I want to run the fluent tutorial model for multiphase flows (VOF). Although I am using SKD to run FLUENT, at the time of compiling the FLUENT UDF, these warnings and errors appear. would you please give me some hints, Thanks M 1 file(s) copied. (system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\win64\2ddp\makefile") 1 file(s) copied. (chdir "libudf")() (chdir "win64\2ddp")() inlet1.c c:\fluent.inc\fluent6.3.26\src\machine.h(114) : warning C4005: 'stdout' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(160) : see previous definition of 'stdout' c:\fluent.inc\fluent6.3.26\src\machine.h(115) : warning C4005: 'stderr' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(161) : see previous definition of 'stderr' c:\fluent.inc\fluent6.3.26\src\machine.h(116) : warning C4005: 'stdin' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(159) : see previous definition of 'stdin' # Generating udf_names.c because of makefile inlet1.obj udf_names.c c:\fluent.inc\fluent6.3.26\src\machine.h(114) : warning C4005: 'stdout' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(160) : see previous definition of 'stdout' c:\fluent.inc\fluent6.3.26\src\machine.h(115) : warning C4005: 'stderr' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(161) : see previous definition of 'stderr' c:\fluent.inc\fluent6.3.26\src\machine.h(116) : warning C4005: 'stdin' : macro redefinition C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(159) : see previous definition of 'stdin' udf_names.c(7) : error C2059: syntax error : '}' udf_names.c(8) : warning C4034: sizeof returns 0 Done. |
Make sure the udf_names.c has been created correctly.
udf_names.c(7) : error C2059: syntax error : '}' udf_names.c(8) : warning C4034: sizeof returns 0 |
Dear Fox
How can I check that? I followed the commands in makefile and it looks like that it doesnt' understand the line below, @sed -n "s/^DEFINE_\([_A-Z]*\)( *\([_a-zA-Z0-9]*\).*)/\{\"\2\", (void (*)())\2, UDF_TYPE_\1\},/p" $(SOURCES) >> $@ But I dont' know what should I do? |
Can u post the UDF definition, or send it to me?
|
The UDF file,
Here is the standard UDF,
#include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #define PI 3.141592654 DEFINE_PROFILE(membrane_speed, /* function name */ th , /* thread */ nv) /* variable number */ { face_t f; real x[ND_ND]; real f_time = RP_Get_Real("flow-time"); begin_f_loop (f,th) { F_CENTROID(x,f,th); if (f_time<=10e-6) {F_PROFILE(f,th,nv) = 3.58*cos(PI*f_time/30e-6); } else F_PROFILE(f,th,nv) = 0; } end_f_loop (f,th) } |
Sed cannot understand your UDF.
Delete the useless comments between UDF name and its parameters, and put them in a single line. Use the following format. Code:
DEFINE_PROFILE(membrane_speed, th, nv) |
udf_names.c(7) : error C2059: syntax error : '}'
hi everybody...
i have same error friends,i've defined an udf file and when i compile it,fluent shows me this error message... thank u in advance:) |
you cannot have any spaces in DEFINE_UDFNAME(a,b,x) syntax
|
UDF error
1 Attachment(s)
I have the same problem and do not know what to do. Please help me.
Copied C:\Users\jianshugao\Desktop\UDF\UDWSPF.c to libudf\src udf_names.c and user_nt.udf files in 2d_host are upto date. (system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\2d_host\makefile" ") 已复制 1 个文件。 (chdir "libudf")(chdir "win64\2d_host")# Generating ud_io1.h UDWSPF.c # Generating udf_names.c because of UDWSPF.obj udf_names.c udf_names.c(7) : error C2059: 语法错误:“}” udf_names.c(8) : warning C4034: sizeof 返回 0 udf_names.c and user_nt.udf files in 2d_node are upto date. (system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\2d_node\makefile" ") 已复制 1 个文件。 (chdir "libudf")(chdir "win64\2d_node")# Generating ud_io1.h UDWSPF.c # Generating udf_names.c because of UDWSPF.obj udf_names.c udf_names.c(7) : error C2059: 语法错误:“}” udf_names.c(8) : warning C4034: sizeof 返回 0 Done. |
The Fluent manual has the line:
Code:
UDF_EXPORT WS_Functions WetSteamFunctionList = Code:
UDF_EXPORT WS_Functions WetSteamFunctionList= |
Thanks for your answer.
But it can not help with the missing space added and the same reply is showed as this: udf_names.c(7) : error C2059: 语法错误:“}” udf_names.c(8) : warning C4034: sizeof 返回 0 |
Can you show the content of udf_names.c?
|
Solution
Recently, I wrote a similar code and the same error:
udf_names.c(7) : error C2059: syntax error : '}' udf_names.c(8) : warning C4034: sizeof returns 0 happened to me. It turned out there is a spece before "DEFINE_PROFILE(membrane_speed,th,nv)". After deleting the space, the code complied smoothly.:) |
All times are GMT -4. The time now is 01:38. |