|
[Sponsors] |
January 22, 2014, 16:03 |
Trouble with compiling UDFs in FLUENT
|
#1 |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Hi everyone,
I know that this topic has been covered to death on this forum, but I'm still having a lot of trouble with it and would really appreciate any input. I am using ANSYS 14.0 and I have a couple different versions of Microsoft Visual Studio installed on my computer (Microsoft Visual Studio 2012, 2012 express for desktop and 213 express for desktop) since I'm not sure which is the most appropriate for my system as far as compatibility. My operating system is Windows 7 (64 bit). I'm not super familiar with Windows OS's so let me know if this is not enough information! I've been going through the Horizontal Film Boiling tutorial provided by ANSYS. This process is presented as straightforward in the tutorials, but I have been seeing a lot of people struggle with it. As of right now, when I try to compile the boiling.c UDF, I get an error that says: — ’nmake’ is not recognized as an internal or external command, operable program, or batch file. — I looked around online (mostly this forum) and found that this problem tends to stem from a lack of communication between the C compiler (Microsoft Visual Studio?) and FLUENT. I have tried a few things to rectify this problem with mixed success: 1. The FLUENT FAQ here has a list of things to do to get UDFs to compile on Windows 7 x64 systems. I went through the process of adding "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files\ANSYS Inc\v120\fluent\ntbin\win64" to the Path system variable as instructed. Unfortunately after doing this, I still got the 'nmake' error. 2. I found many, many recommendations to start FLUENT through Visual Studio’s command prompt. I did that (both with and without the added locations to the Path system variable) and the 'nmake' error went away but then I was running into different errors " error LNK2019: unresolved external symbol" for several different variables in the UDF. Right not I'm not able to reproduce this error because I can't seem to get FLUENT to run from my MSVS command prompt anymore. At this point, I have not been able to find a satisfactory solution to my problems. I get the feeling that it is stemming from my lack of understanding about the relationship between MSVS and SDK and FLUENT. I don't really understand why I need an SDK installed in addition to MSVS or what MSVS's actual role is in the whole process of compiling within FLUENT. Does anyone have any thoughts or resources they can point me to? Thank you! The experience documented by user trollreign is very similar to what I've been experiencing, though he/she does not seem to have had any of the LNK2019 errors as I have: http://www.cfd-online.com/Forums/blo...pile-udfs.html If I can figure out what's going on for me, I would love to do a similar blog post just to get the info out there for people! |
|
January 23, 2014, 06:06 |
how to solve nmake problems
|
#2 |
New Member
Happy_weekend
Join Date: Jan 2014
Posts: 21
Rep Power: 12 |
I once also met the problems like you. visual studio 2012 is ok for fluent 14.0.
I think you need to add some system variables to your computer, not only path. Generally, there are four variables needed to be added, inclued, lib, path, and libpath. The values of them are listed as follows. I think you need to change the related address because these files may be in different addresses. name: Include value: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include Second: name: Lib value: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib Third: name: Libpath value: C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Windo ws\Microsoft.NET\Framework64\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib Fourth: name: Path value: C:\Program Files\ANSYS Inc\v140\fluent\ntbin\win64;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;C:\Windows\Microsoft.NET\Framework64\v3 .5;C:\Windows\Microsoft.NET\Framework64\v2.0.50727 ;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin After you have done this, the nmake problem can be solved. Good Luck! |
|
January 23, 2014, 11:44 |
|
#3 | |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Thank you so much for responding! I did as you recommended and you were right - I did have to change some of the folder names like the Visual Studio version (from 9.0 to 12.0) and the Windows SDKs version (from 6.0A to 7.1A). I was not able to find the following folder anywhere:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc So I left that value out of the Include, Lib, and Libpath variables. I went to compile the UDF with the defined/updated system variables and I didn't get the 'nmake' error! That's pretty refreshing! Unfortunately, I got hit with a whole new set of errors that I can make NO sense of: Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(482) : error C2059: syntax error : ',' Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(482) : error C2143: syntax error : missing ')' before 'constant' Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(482) : error C2143: syntax error : missing '{' before 'constant' Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(482) : error C2059: syntax error : 'constant' Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h(482) : error C2059: syntax error : ')' It doesn't seem appropriate for me to go into that math.h header file and change things since it came with MSVS. I'm wondering if it has to do with the file path that I left out because I couldn't find it. I will try to look around! Quote:
|
||
January 23, 2014, 12:57 |
|
#4 |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Oh my goodness! I got it to work! It's a miracle! For you future people searching desperately for a solution to your UDF compiling issues:
1. I updated the Path variable as instructed by user Messi. 2. I added new variables Include, Lib, and Libpath variables as instructed by user Messi. 3. I used the VS2012 x64 Cross Tools Command Prompt to open FLUENT (after first navigating to my working directory). ***THIS DID NOT WORK WITH ANY OTHER COMMAND PROMPT I TRIED!*** |
|
January 28, 2014, 07:35 |
|
#5 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
I have fluent 14 on win 7 OS. I have Visuald Studio from 2008 to 2012 installed. I've been dealing with the x64 system problem exposed by trollreign in http://www.cfd-online.com/Forums/blo...pile-udfs.html Error message: Code:
Opening library "c:\users\<working directory>libudf"... Error: The UDF library you are trying to load (C:\Users\<working directory>\libudf) is not compiled for 3d on the curent platform (win64). I then decided to update environment variables as exposed by Messi in http://www.cfd-online.com/Forums/flu...tml#post471365 I changed SDK version from 6.0A to 7.1A and VS from 2009 to 2011 (I haven't been able to find a VS2012 folder in my pc, even if I have it correctly installed.) I started from VS2012 x64 Cross Tools Command Prompt and I get this error: Code:
c:\program files\ansys inc\v140\fluent\fluent14.0.0\src\global.h(10) : fatal error C1083: Cannot open the include archive: 'stdio.h': Invalid argument What can be wrong? I've also tried the other command prompts in VS2012 with similar result. I've tried serial and parallel modes. What can I try next? Please help, I'm in a hurry. Thanks a lot!! |
||
January 28, 2014, 10:12 |
|
#6 | |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
When you say you're starting from MSVS Command Prompt, what exactly are you typing into the command prompt?
Quote:
|
||
January 28, 2014, 10:55 |
|
#7 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
But I see now there's some message in the Command Prompt before I write anything: ERROR: Cannot determine the location of the VS Common Tools Folder. Can this be related to my problem? I guess it does. How can I solve it? Thanls a lot! |
||
January 28, 2014, 11:15 |
|
#8 |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Okay here's what I did.
cd C:\filmboiling (this is changing the directory to my working directory, the folder containing my mesh file and my .c file) fluent (this opens up the FLUENT launcher directly, and you can see under the General Options that the working directory has been changed accordingly) Then I followed the instructions for compiling a UDF and it works fine. Is that how you did it? |
|
January 28, 2014, 11:18 |
|
#9 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
|
||
January 28, 2014, 11:24 |
|
#10 |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
I get the same error even if I type my working directory.
|
|
January 28, 2014, 11:32 |
|
#11 |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
Okay, I was looking over trollreign's blogpost again and the error you're getting about libudf not being compiled for 3d on the current platform seems like a 64 bit problem? You didn't mention in your original post if your copies of MSVS for 64 bit - are they? Maybe that's the problem.
As you can see I am in no way an expert on this kind of stuff so if anyone else wants to chime in, please do! |
|
January 28, 2014, 11:52 |
|
#12 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
http://www.microsoft.com/en-us/downl....aspx?id=30678 Do you have the error message when you start your command prompt? ERROR: Cannot determine the location of the VS Common Tools folder. |
||
January 28, 2014, 12:03 |
|
#13 |
New Member
Christina P.
Join Date: Oct 2012
Posts: 22
Rep Power: 14 |
No, I never got that error. That might be the problem! What does the Path variable value look like in your system variables? Maybe one of your folder locations got messed up.
|
|
January 28, 2014, 14:15 |
|
#14 |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
My environment variables are the followings, I've checked that every folder really exist in my pc:
Code:
name: include value: C:\Program Files\Microsoft SDKs\Windows\v7.1A\Include; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include name: lib value: C:\Program Files\Microsoft SDKs\Windows\v7.7A\Include; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include name:libpath value: C:\Windows\Microsoft.NET\Framework64\v3.5; C:\Windows\Microsoft.NET\Framework64\v2.0.50727; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\lib; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib name: path value: C:\Program Files\ANSYS Inc\v140\fluent\ntbin\win64; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin; C:\Windows\Microsoft.NET\Framework64\v3.5; C:\Windows\Microsoft.NET\Framework64\v2.0.50727; C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcpackages; C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE; C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools; C:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\x64; C:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin |
|
January 30, 2014, 06:13 |
|
#15 |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
It looks like I have some trouble with my SDK and VS2012. When I try to execute the Windows SDK Command Prompt it appears an error message:
Code:
The x64 compilers are not currently installed Please go to add/remove programs to update the installation. Setting SDK environments relative to C:Program Files\Microsoft SDKs\Windows\v7.0 El sistema no encuentra la etiqueta por lotes especificada: Set_x64 How can I solve my sdk problem? Which versions of SDK, V and c++ compiler should I try? Anything that works! Thanks. |
|
January 30, 2014, 11:52 |
|
#16 |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
I solved the SDK issue, now I have SDK 7.1. I've installed a patch and now there's no message of x64 compilers on the SDK 7.1 command prompt.
But, neither I start from SDK command prompt nor VS2012 command prompt my udf is able to be compiled. Always the same messege: Code:
fatal error 1083: cannot open the file include: stdio.h invalid argument Error: The UDF library you are trying to load (libudf) is not compiled for 3d on the curent platform (win64). Cp703 which is your setup? which are the Visual Studio and SDK versionsworking for you? SDK 7.1 ans MS VS 2012 Ultimate? Should I uninstall former versions of this softwares? Which environment variable should I choose? Thank you! |
|
January 30, 2014, 12:12 |
|
#17 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
I've gone on and there's a new error when building: Code:
inlet_x_profile.c(23) : error C2064: term does not evaluate to a function taking 1787 arguments And then there's the persistent x64 error when compiling. |
||
January 31, 2014, 04:06 |
|
#18 | |
Senior Member
Francisco
Join Date: Mar 2012
Location: Spain
Posts: 273
Rep Power: 15 |
Quote:
Thank you cp703 for your help! |
||
March 10, 2014, 13:02 |
Error
|
#19 |
New Member
Afshin
Join Date: Mar 2014
Posts: 2
Rep Power: 0 |
Hello Experts
I followed all the instructions mentioned, however when I compile the udf file I get the following error: Opening library "D:\WS7b\libudf"... Error: The UDF library you are trying to load (libudf) is not compiled for 2ddp on the current platform (win64). The system cannot find the file specified. I should mention that among all the values mentioned by messi there is one that I cannot find : c:\Program files(x86)\Microsoft SDKs\Windows\V7.0A\Include Your help is highly appreciated. Afshin |
|
March 10, 2014, 13:04 |
|
#20 |
New Member
Afshin
Join Date: Mar 2014
Posts: 2
Rep Power: 0 |
One more
I'm using ANSYS 15 and Windows 7 Ultimate, I installed VS2012, Thanks Afshin |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Windows Environment variables- to solve problems in compiling UDF in Fluent | Modest Cat | Fluent UDF and Scheme Programming | 39 | May 18, 2016 11:33 |
Error while compiling udf in fluent 13.0.0 | siddharth12 | FLUENT | 0 | December 3, 2013 17:46 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 10:28 |
Compiling UDFs under Windows XP | Hannah | FLUENT | 3 | February 13, 2005 09:16 |
Compiling and Running UDFs on an IBM Power3 | S. Hollman | FLUENT | 0 | January 6, 2005 12:23 |