CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   udf_names.c(7) : error C2059: syntax error : '}' (https://www.cfd-online.com/Forums/fluent-udf/75500-udf_names-c-7-error-c2059-syntax-error.html)

wingsinblue April 27, 2010 14:26

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.

fox000002 April 28, 2010 10:59

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

wingsinblue April 28, 2010 22:53

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?

fox000002 April 29, 2010 00:26

Can u post the UDF definition, or send it to me?

wingsinblue April 29, 2010 13:53

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)
}

fox000002 April 30, 2010 03:33

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)

almostafa67 August 1, 2010 05:20

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:)

gaza January 25, 2016 09:10

you cannot have any spaces in DEFINE_UDFNAME(a,b,x) syntax

jianshu gao May 25, 2016 03:33

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.

pakk May 25, 2016 06:23

The Fluent manual has the line:

Code:

UDF_EXPORT WS_Functions WetSteamFunctionList =
Your code has the line:

Code:

UDF_EXPORT WS_Functions WetSteamFunctionList=
That missing space could be very important.

jianshu gao May 25, 2016 09:11

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

pakk May 25, 2016 10:59

Can you show the content of udf_names.c?

yaobenchun March 29, 2017 08:55

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.