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/)
-   -   what is syntax error : missing ')' before ';' (https://www.cfd-online.com/Forums/fluent-udf/89707-what-syntax-error-missing-before.html)

aleisia June 20, 2011 15:06

what is syntax error : missing ')' before ';'
 
I'm pretty sure that I have no problem with the ‘;’ and ')', but still I got that error. Some said it is because of the compiler, but I followed the ansys technical support's direction, using vs 2010 express edition+windows sdk 7.0+.net framework 3.5 sp1 to start fluent in my win7 64bit system.

Fluent can be smoothly started without problem.


Please help.


Thanks.



Deleted old \MECHSE-JACOB-02\users\meng8\desktop estbed\libudf\win64\3ddp_host\libudf.dll
\MECHSE-JACOB-02\users\meng8\desktop estbed\libudf\win64\3ddp_node\libudf.dll
1 file(s) copied.
(system "copy "C:\ANSYSI~1\v121\fluent"\fluent12.1.4\src\makefil e_nt.udf \MECHSE-JACOB-02\users\meng8\desktop\testbed\libudf\win64\3ddp_h ost\makefile")


1 file(s) copied.
(chdir "\MECHSE-JACOB-02\users\meng8\desktop\testbed\libudf")()

(chdir "win64\3ddp_host")()

C:\Windows\twain.dll
C:\Windows\twain_32.dll
# Generating ud_io1.h
udfsource.c

..\..\src\udfsource.c(102) : error C2065: 'tepflowrate' : undeclared identifier
..\..\src\udfsource.c(102) : warning C4133: 'function' : incompatible types - from 'int *' to 'double *'
..\..\src\udfsource.c(102) : error C2065: 'vol_tot' : undeclared identifier
..\..\src\udfsource.c(102) : warning C4133: 'function' : incompatible types - from 'int *' to 'double *'
..\..\src\udfsource.c(105) : error C2065: 'source' : undeclared identifier
..\..\src\udfsource.c(105) : error C2065: 'tepflowrate' : undeclared identifier
..\..\src\udfsource.c(105) : error C2065: 'vol_tot' : undeclared identifier
..\..\src\udfsource.c(107) : error C2065: 'source' : undeclared identifier
..\..\src\udfsource.c(108) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource.c(108) : error C2143: syntax error : missing ';' before ','
..\..\src\udfsource.c(108) : error C2059: syntax error : ')'


'\\MECHSE-JACOB-02\users\meng8\desktop\testbed'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
'\\MECHSE-JACOB-02\users\meng8\desktop\testbed'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

(system "copy "C:\ANSYSI~1\v121\fluent"\fluent12.1.4\src\makefil e_nt.udf \MECHSE-JACOB-02\users\meng8\desktop\testbed\libudf\win64\3ddp_n ode\makefile")

'\\MECHSE-JACOB-02\users\meng8\desktop\testbed'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
1 file(s) copied.
(chdir "\MECHSE-JACOB-02\users\meng8\desktop\testbed\libudf")()

(chdir "win64\3ddp_node")()

C:\Windows\twain.dll
C:\Windows\twain_32.dll
# Generating ud_io1.h
udfsource.c

..\..\src\udfsource.c(22) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource.c(22) : error C2059: syntax error : ')'
..\..\src\udfsource.c(23) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource.c(23) : error C2059: syntax error : ')'
..\..\src\udfsource.c(89) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource.c(89) : error C2059: syntax error : ')'
..\..\src\udfsource.c(90) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource.c(90) : error C2059: syntax error : ')'

Micael June 29, 2011 14:29

I don't know if that was your case, but there is a C rule that can be very annoying for one that is not aware of it. You should put every declaration before any operation. As an example, this produces the kind of error you got:

Code:


 int j;
 j = 1;
 int i;


shivakumar March 10, 2015 03:46

I have encountered the same problem.. Have you resolved it?

`e` March 10, 2015 06:59

If you have the same error then post your UDF code. The error code states the line number where the error has occurred.

shivakumar March 10, 2015 07:02

Thanks for the reply.. code is below


#include "udf.h"
#define a 340.26

DEFINE_ON_DEMAND(shock_sensor)
{
Domain *d;
Thread *t;
cell_t c;
d=Get_Domain(1);

real f_shock, velocity;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
velocity=(C_U(c,t)+C_V(c,t));
f_shock = (velocity*C_P_G(c,t))/(a*abs(C_P_G(c,t)));

if(f_shock>=1)
{
C_UDMI(c,t,0)=f_shock;
}
}
end_c_loop(c,t)
}
}

I think I need to change the macro, but not sure...:(

Thanks

`e` March 10, 2015 07:12

Are you running in serial or parallel, and what is your error message exactly?

`e` March 10, 2015 07:15

First of all, you should declare your variables before assigning values to them as pointed out by Micael in this thread we're currently in.

Try:

Code:

Domain *d;
Thread *t;
cell_t c;
real f_shock, velocity;
d=Get_Domain(1);


shivakumar March 10, 2015 13:08

1 Attachment(s)
Quote:

Domain *d;
Thread *t;
cell_t c;
real f_shock, velocity;
d=Get_Domain(1);
Thank you. Awesome suggestion, my errors reduced but still got 3 errors. I think I need to change the macro, not sure. I'm running on serial right now and will attach my sensor and viscous algorithm.

UDF is this

#include "udf.h"
#define A 340.26

DEFINE_ON_DEMAND(shock_sensor)
{
Domain *d;
Thread *t;
cell_t c;
real f_shock, velocity;
d=Get_Domain(1);


thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
velocity=(C_U(c,t)+C_V(c,t));
f_shock = (velocity*C_P_G(c,t))/(A*fabs(C_P_G(c,t)));

if(f_shock>=1)
{
C_UDMI(c,t,0)=f_shock;
}
}
end_c_loop(c,t)
}
}



Error is below.


# Generating ud_io1.h
shock_sensor.c
..\..\src\shock_sensor.c(18) : error C2297: '*' : illegal, right operand has type 'real [2]'
..\..\src\shock_sensor.c(18) : error C2440: 'function' : cannot convert from 'real [2]' to 'double'
..\..\src\shock_sensor.c(18) : warning C4024: 'fabs' : different types for formal and actual parameter 1

Done.


Thanks in advance

`e` March 10, 2015 16:42

See my reply in this thread and please do not post duplicate questions in multiple threads.


All times are GMT -4. The time now is 09:58.