CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Undeclared Identifier Errof UDF (http://www.cfd-online.com/Forums/fluent-udf/99174-undeclared-identifier-errof-udf.html)

SteveGoat March 27, 2012 17:36

Undeclared Identifier Errof UDF
 
Hi everyone,
I'm running fluent on windows xp 32bit and trying to compile a UDF with Visual Studio 9.0 (2008). I've done everything reported within this website:

-set the environmental variables for Visual Studio
-set the environmental variable for fluent
-launch fluent from the Visual C++ command window after browsing to the .cas and .dat folder

However I'm still not able to compile it correctly.
It is worth noting that the some source files compile perfectly on a Linux 64bit machine!


1 file copiati.
1 file copiati.
1 file copiati.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\3d\makefile")
1 file copiati.
(chdir "libudf")()
(chdir "ntx86\3d")()
compute_cs.c
c:\fluent.inc\fluent6.3.26\src\global.h(194) : warning C4005: 'SQR' : macro redefinition
c:\documents and settings\capra\desktop\prove fluent\libudf\src\nrutil.h(12) : see previous definition of 'SQR'
..\..\src\compute_cs.c(41) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\compute_cs.c(41) : error C2146: syntax error : missing ';' before identifier 'd'
..\..\src\compute_cs.c(41) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(41) : error C2109: subscript requires array or pointer type
..\..\src\compute_cs.c(42) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\compute_cs.c(42) : error C2146: syntax error : missing ';' before identifier 'e'
..\..\src\compute_cs.c(42) : error C2065: 'e' : undeclared identifier
..\..\src\compute_cs.c(42) : error C2109: subscript requires array or pointer type
..\..\src\compute_cs.c(43) : error C2143: syntax error : missing ';' before 'type'
..\..\src\compute_cs.c(44) : error C2143: syntax error : missing ';' before 'type'
..\..\src\compute_cs.c(45) : error C2275: 'bool' : illegal use of this type as an expression
..\..\src\compute_cs.c(10) : see declaration of 'bool'
..\..\src\compute_cs.c(45) : error C2146: syntax error : missing ';' before identifier 'use_stat'
..\..\src\compute_cs.c(45) : error C2065: 'use_stat' : undeclared identifier
..\..\src\compute_cs.c(48) : error C2065: 'use_stat' : undeclared identifier
..\..\src\compute_cs.c(49) : error C2065: 'nlambda' : undeclared identifier
..\..\src\compute_cs.c(50) : error C2065: 'nmean' : undeclared identifier
..\..\src\compute_cs.c(51) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(54) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(65) : error C2065: 'use_stat' : undeclared identifier
..\..\src\compute_cs.c(68) : error C2065: 'nmean' : undeclared identifier
..\..\src\compute_cs.c(68) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(68) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(68) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(69) : error C2065: 'nmean' : undeclared identifier
..\..\src\compute_cs.c(69) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(69) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(69) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(70) : error C2065: 'nmean' : undeclared identifier
..\..\src\compute_cs.c(70) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(70) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(70) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(79) : error C2065: 'use_stat' : undeclared identifier
..\..\src\compute_cs.c(91) : error C2065: 'use_stat' : undeclared identifier
..\..\src\compute_cs.c(93) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(94) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(95) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(96) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(97) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(98) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(99) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(100) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(101) : error C2065: 'ngrad' : undeclared identifier
..\..\src\compute_cs.c(155) : error C2065: 'n' : undeclared identifier
..\..\src\compute_cs.c(155) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(155) : warning C4047: 'function' : 'real *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(155) : warning C4024: 'tred2' : different types for formal and actual parameter 2
..\..\src\compute_cs.c(155) : error C2065: 'e' : undeclared identifier
..\..\src\compute_cs.c(155) : warning C4047: 'function' : 'real *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(155) : warning C4024: 'tred2' : different types for formal and actual parameter 3
..\..\src\compute_cs.c(157) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(157) : warning C4047: 'function' : 'real *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(157) : warning C4024: 'tqli' : different types for formal and actual parameter 1
..\..\src\compute_cs.c(157) : error C2065: 'e' : undeclared identifier
..\..\src\compute_cs.c(157) : warning C4047: 'function' : 'real *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(157) : warning C4024: 'tqli' : different types for formal and actual parameter 2
..\..\src\compute_cs.c(157) : error C2065: 'n' : undeclared identifier
..\..\src\compute_cs.c(159) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(159) : warning C4047: 'function' : 'real *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(159) : warning C4024: 'eigsrt' : different types for formal and actual parameter 1
..\..\src\compute_cs.c(159) : error C2065: 'n' : undeclared identifier
..\..\src\compute_cs.c(162) : error C2065: 'nlambda' : undeclared identifier
..\..\src\compute_cs.c(162) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(162) : error C2109: subscript requires array or pointer type
..\..\src\compute_cs.c(163) : error C2065: 'nlambda' : undeclared identifier
..\..\src\compute_cs.c(163) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(163) : error C2109: subscript requires array or pointer type
..\..\src\compute_cs.c(164) : error C2065: 'nlambda' : undeclared identifier
..\..\src\compute_cs.c(164) : error C2065: 'd' : undeclared identifier
..\..\src\compute_cs.c(164) : error C2109: subscript requires array or pointer type
..\..\src\compute_cs.c(365) : error C2275: 'Thread' : illegal use of this type as an expression
C:\Fluent.Inc\fluent6.3.26\src\mem.h(653) : see declaration of 'Thread'
..\..\src\compute_cs.c(365) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(366) : error C2275: 'cell_t' : illegal use of this type as an expression
C:\Fluent.Inc\fluent6.3.26\src\mem.h(173) : see declaration of 'cell_t'
..\..\src\compute_cs.c(366) : error C2146: syntax error : missing ';' before identifier 'c'
..\..\src\compute_cs.c(366) : error C2065: 'c' : undeclared identifier
..\..\src\compute_cs.c(367) : error C2275: 'face_t' : illegal use of this type as an expression
C:\Fluent.Inc\fluent6.3.26\src\mem.h(168) : see declaration of 'face_t'
..\..\src\compute_cs.c(367) : error C2146: syntax error : missing ';' before identifier 'f'
..\..\src\compute_cs.c(367) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(370) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(370) : warning C4047: '=' : 'int' differs in levels of indirection from 'thread_struct *'
..\..\src\compute_cs.c(370) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(370) : warning C4047: '!=' : 'void *' differs in levels of indirection from 'int'
..\..\src\compute_cs.c(370) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(370) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(370) : error C2223: left of '->next' must point to struct/union
..\..\src\compute_cs.c(372) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(372) : error C2223: left of '->nelements' must point to struct/union
..\..\src\compute_cs.c(372) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(372) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(372) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(377) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(377) : error C2223: left of '->flags' must point to struct/union
..\..\src\compute_cs.c(384) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(384) : error C2223: left of '->storage' must point to struct/union
..\..\src\compute_cs.c(384) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(385) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(385) : error C2223: left of '->t0' must point to struct/union
..\..\src\compute_cs.c(386) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(386) : error C2223: left of '->storage' must point to struct/union
..\..\src\compute_cs.c(386) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(387) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(387) : error C2223: left of '->t1' must point to struct/union
..\..\src\compute_cs.c(390) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(390) : error C2223: left of '->storage' must point to struct/union
..\..\src\compute_cs.c(390) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(390) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(390) : error C2223: left of '->storage' must point to struct/union
..\..\src\compute_cs.c(390) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(390) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(390) : error C2223: left of '->storage' must point to struct/union
..\..\src\compute_cs.c(390) : error C2065: 'f' : undeclared identifier
..\..\src\compute_cs.c(400) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(400) : error C2223: left of '->flags' must point to struct/union
..\..\src\compute_cs.c(407) : error C2065: 'tf' : undeclared identifier
..\..\src\compute_cs.c(407) : fatal error C1003: error count exceeds 100; stopping compilation
nrutil.c
Generating Code...

Done.

Does anyone have the same problem?
Thank you so much
Steve

Remedios May 2, 2012 10:04

Hello,

Could you solve this problem?

SteveGoat May 17, 2012 05:37

No I'm sorry

Remedios May 17, 2012 11:19

I could solve it. My problem was the UDF I was using was written in Linux and I was using it in Windows. I noticed that I needed to write my data type first. For example, for your error " 'real' : illegal use of this type as an expression", define your variable at the top of your loop before any declaration.

SteveGoat May 18, 2012 03:27

Hi, that's a great news, I'm still dealing with it. What do you mean exactly? Do you declare all of them even if are local variables at the top of the code?
Thanks
STefano

shashank312 May 30, 2013 18:35

Remedios, could you explain on how you solved it?

tom634 April 1, 2014 07:20

I am facing similiar problem.

Pascal0 October 15, 2014 07:11

According to "left of '->storage' must point to struct/union" error I had the same problem. This is a part of a code, that is supposed to calculate temperature on face, but it is not a case:

begin_f_loop(f,thr_outlet)
{
real area=0.0;

real NV_VEC(farea); /* defines vector "farea"*/
F_AREA(farea,f,t); /* computes area of each face */
area = NV_MAG(farea);

area_sum = area_sum + area;
sum_area_temp = sum_area_temp + area * F_T(f,thr_outlet); /* additions subsequent temperatures on faces */
}
end_f_loop(f,thr_outlet)
}

Those two thread names should be the same. I left default one after pasting from another source. After changing "f" on "thr_outlet" in "F_AREA" problem was solved. Hope this helped at least a bit.


All times are GMT -4. The time now is 04:05.