|
[Sponsors] |
October 25, 2013, 06:44 |
UDF error concerning math.h
|
#1 |
New Member
Marie
Join Date: Oct 2013
Location: Knk
Posts: 24
Rep Power: 13 |
Hi,
I compiled my UDF on fluent v145 and I have got this error concerning math.h However in my header I donīt add math.h (I have tried with and I have no changes). I have also download a new math.h file and remplace it in my ansys\v145\....\src\math.h file. Copied C:\Users\urdfa\Desktop\UDF essai\25_10_files\dp0\FFF\MECH/C:\Users\urdfa\Desktop\UDF essai\25_10_files\dp0\FFF\MECH\vitesse.c to libudf\src Copied C:\Program Files\ANSYS Inc\v145\fluent\fluent14.5.0\src\udf.h to libudf\src ************************************************** ************************ ** NOTE: user_nt.udf file is outdated. So, recreating the file for 2d ... ************************************************** *********************** (system "copy "C:\PROGRA~1\ANSYSI~1\v145\fluent"\fluent14.5.0\sr c\makefile_nt.udf "libudf\win64\2d\makefile" ") 1 Datei(en) kopiert. (chdir "libudf")() (chdir "win64\2d")() # Generating ud_io1.h vitesse.c C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: ',' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: Syntaxfehler: Es fehlt ')' vor 'Konstante' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: Syntaxfehler: Es fehlt '{' vor 'Konstante' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: 'Konstante' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: ')' I also add my UDF Perharps the error comes from my UDF, but I have found no error with Visual Studio) /************************************************** ********************* vprofile.c UDF for specifying steady-state velocity profile boundary condition ************************************************** **********************/ #include "udf.h" DEFINE_PROFILE(x_velocity,thread,position) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = 5; } end_f_loop(f, thread) } Thank you in advance for any idea concerning my issue. |
|
October 27, 2013, 10:30 |
|
#2 |
New Member
|
I am trying the exact same thing and I am getting the same error.
My UDF is pretty similar to yours, I am trying to implement a user-defined velocity profile on my boundary using an UDF. When I try to compile it, it gives the same errors with the math.h file located in Visual Studio 12. Done. Deleted old libudf\win64\2d\libudf.dll 1 file(s) copied. Copied J:\CFD\004_vertflow\velocity_profile.c to libudf\src (system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\2d\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "win64\2d")() # Generating ud_io1.h velocity_profile.c C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : ',' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: syntax error : missing ')' before 'constant' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: syntax error : missing '{' before 'constant' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : 'constant' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : ')' Done. Further information for those trying to help. 1. I also tried to get a math.h file from the internet and load it as a header file on the right of the screen. This way it also gave the same errors from the math.h file located in the Visual Studio 12 folder's VC library, AND in addition some errors from the other math.h header file I attached. In any case, it looks for the math.h file of VS12, whether you attached it or not. 2. Visual Studio 12 is actually the Microsoft Visual Studio 2013 Express that Microsoft released recently. Is it possible that their math.h file is simply wrong? Or that it is not compatible with Fluent 14.0 for some reason? 3. If I try to load the profile after building it with errors, I get the following error message: The UDF library you are trying to load (libudf) is not compiled for 2d on the curent platform (win64). The system cannot find the file specified. J:\CFD\004_vertflow\libudf\win64\2d\libudf.dll So it seems that the .dll file was not created. Somehow the dll should be linked but it isn't. In a video on YouTube I saw that the right message Fluent should give would be: http://www.youtube.com/watch?v=rT3a-Lu7LI4 |
|
October 27, 2013, 15:56 |
Have to replace math.h
|
#3 |
New Member
|
After several hours I found a solution to the problem.
So my setup is: - Windows 8.1 x64 - ANSYS v140 x64 - Microsoft Visual Studio 2013 Express (which is the same as Microsoft Visual Studio 12) - Microsoft Windows Software Development Kit (SDK) 8.1 - Microsoft .NET Framework 4.5.1 The environmental variables were set, I ran Fluent from the command prompt properly with x64, the compiler was specified. The above problem occurred (see KITetima' post) at compilation. Solution: 1. In addition to above mentioned software, install Microsoft Visual C++ Express 2010. 2. Copy the math.h file from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include (this is with standard installation folders) 3. Start Fluent from the VS2013 x64 Cross Tools Command Prompt. If you go to the Start screen (windows key on the keyboard) and type "Visual Studio Tools" you will find this command prompt in that folder. Note that starting fluent from the command prompt of Visual Studio 2010 will not work, you need a 64 bit environment (x64) Hope this helps. |
|
October 28, 2013, 05:20 |
|
#4 |
New Member
Marie
Join Date: Oct 2013
Location: Knk
Posts: 24
Rep Power: 13 |
Thank you. You have solved my problem with this math.h error !
|
|
November 19, 2013, 17:31 |
|
#5 |
New Member
Join Date: Aug 2012
Posts: 22
Rep Power: 14 |
Lazlo and Marie, its seems Ansys Fluent is not compatible with last version of MSVS. I'm using Ansys Fluent 12.1 and I solved the same problem just copying math.h from:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include and now Fluent in compiling my UDF properly. Regards. |
|
December 2, 2013, 11:04 |
It worked !!!
|
#6 |
New Member
J.G.E.
Join Date: Oct 2013
Posts: 2
Rep Power: 0 |
Man, God Bless you !! I had this problem for a long time with no solution, I tried all version of Visual Studio and nothing worked, but now you saved my life !!!
Thanks again ... |
|
December 2, 2013, 11:27 |
|
#7 |
New Member
Join Date: Aug 2012
Posts: 22
Rep Power: 14 |
Because of I'm using Ansys Fluent 12.1, I had to edit the udf.bat file to indicate to Fluent has to use MSVS 12, maybe if you're using a later Fluent release, you don't have to do this.
Regards. |
|
January 23, 2014, 07:42 |
|
#8 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
Can I ask anyone of you to share with me just a math.h file from VS2010?
|
|
May 30, 2014, 23:59 |
|
#9 |
New Member
Junphy Liues
Join Date: Apr 2014
Posts: 9
Rep Power: 12 |
||
June 17, 2014, 07:39 |
|
#10 |
New Member
Dawie Marais
Join Date: Jan 2014
Posts: 6
Rep Power: 12 |
Hi guys,
Would it be possible to please share a math.h file from VS2010 on this thread? I also have the same problem but I am having trouble installing VS2010 due to proxy issues. Thanks! |
|
June 18, 2014, 03:11 |
|
#11 |
New Member
Dawie Marais
Join Date: Jan 2014
Posts: 6
Rep Power: 12 |
Attached is the math.h file from VS2010 should anyone need it- it works very well indeed!
|
|
July 29, 2014, 13:30 |
udf math.h error on visual studio 2013
|
#12 |
New Member
WangLei
Join Date: Mar 2011
Posts: 2
Rep Power: 0 |
In Visual Studio 2013, I found Line 482 in the math.h:
Code:
_CRTIMP double __cdecl cbrt(_In_ double _X); delete it or wrap with /**/, the error C2059 and C2143 would disappear, then you need not copy another math.h file. I have no idea what's wrong with this code. |
|
February 21, 2015, 20:50 |
|
#13 |
New Member
Ugur Goktolga
Join Date: Jul 2013
Posts: 4
Rep Power: 13 |
Thank you trollreign, thank you very much!
|
|
August 6, 2016, 07:46 |
Thanks to help in compiling UDF in Fluent
|
#15 |
New Member
uday joshi
Join Date: Aug 2016
Posts: 1
Rep Power: 0 |
Dear Friends..
Thank you all so much.... I was messed since long in compilation issue..... You all made my Day....!! |
|
May 4, 2017, 10:31 |
|
#16 |
New Member
Ahmad
Join Date: May 2017
Posts: 1
Rep Power: 0 |
Thank you very much guy. Your solution saved my life
|
|
May 5, 2017, 09:46 |
|
#17 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
||
May 14, 2017, 06:20 |
|
#18 |
New Member
Sai Vishnu Vardhan Kopalli
Join Date: May 2017
Posts: 1
Rep Power: 0 |
Thank You very much trollreign, it worked!!!
But after loading I am receiving error 193. Please give me a way |
|
January 26, 2018, 21:34 |
|
#19 |
New Member
Mahmoud alaa
Join Date: Feb 2016
Posts: 1
Rep Power: 0 |
Thank you very much!
|
|
February 16, 2018, 15:34 |
This code modification is the solution!
|
#20 | |
New Member
Join Date: Jan 2018
Posts: 12
Rep Power: 8 |
Quote:
I was having the same trouble when trying to compile the UDF in Fluent 13. My OS is Windows 10, and I open Fluent using the x64 Native Tools Command Prompt for MS Visual Studio 2017 (yes, the latest). In my case, the same error was found in file "corecrt_math.h", which is in the folder (and subfolders) of Windows Kits (in Program Files (x86)), not directly in the any MS Visual Studio subfolders. I guess it's just how the structure is in Windows 10. Anyway, this guy's suggestion really saved me a lot of time and disc space . No need to install any older version of VS, and just modify the codes. Cheers! Daniel |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |