ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Good Morning Dear All,
I am happy to put forward solution to resolve the difficulty to compile udf. As I myself have gone through it resolving for long time, I like to share the solution with u. I request to put off all your defensive mechanisms from minds and hearts that dealing with udf's is a tough problem, infact they r easy and most helpful shoud we undrstand wat all udf's logic is about and how grid is represented in terms of co-ords and so on. the most basic and fundamental programming knowledge is desired but not essential to write udf. First and foremost, this method is specifically applicable to the problem of getting any of the statements below wen u try to BUILD the udf and subsequently load it. 'CANT FIND NMAKE' , 'CHNG DIRC' (chdir "libudf")() (chdir "ntx86\\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. I have come accross many proposals by my seniors and on forums and help files etc etc but none worked out to a general logical solution to the problem, for example the most general solution i found on forums is unistall fluent first, then install vc++ then again install fluent then set environment etc... (for people using unix operating system, go to the last lines of the post.). One more Example: First you have read ur case/mesh file before u compile it.....etc etc. there is no need for that. first u can compile then read ur case file and hook ur udf's. there is no need to do all the stuff like the above ones stated above. im putting forward the procedure and possible pit falls we generally do when we try to compile a udf. I am putting forward detailed steps understandable for a novice fluent/udf user too. experienced users may ignore a few of the comments below without getting bored. Step 1. if fluent is already intalled, the default folder is C:\FLUENT.INC if you dint change it when u install it on your computer. there is nothing to disturb fluent. leave it as it is. Step 2a. Install Microsoft Visual Studio (written MSVS from now on) (with all components including MSDN and .net, .bat and not just VC++ I repeat not JUST VC++. the express edition of MSVC++ has only debugger and not compiler and will not serve the purpose of compiling fluent udf's). MSVS will take around 500 to 700 mb space of ur hard disk but its worth. Step 2b. But the default folder will be C:\Program files\Microsoft Visual studio (x.x edition)\...., change this to C:\Microsoft Visual studio (x.x edition)\..... Step 3. While u r installing, a promt is displayed asking to chek an option if you want to have command line comiler etc..., chek the box (MOST IMPORTANT chek the box). Doing this enables command line compiler and Fluent needs and searches only for this. It has to find this command line compiler to compile udfs. Step 4. If the system asks for rebooting/restarting the system for the setup to take effect, do it. Step 5. Now after the system reboots, right click my computer ---> properties ----> advanced tab. on the bottom part u have environment variables and system variables. Step 5a. In the environment vairable add the variable for MSVS along wiht the fluent, and add path (same as that set in step 2b) also along with fluent path separtated by a semicolon. Step 5b. To carry out this step, u need to have administrative rights for the computer u r using. In the system variables panel add the same path (generally on installing this is added for MSVC, chek to make sure that this is added). In the system varaibles path also follwo step 5a. Step 6: Reset environment variables for fluent once again. (Start Menu ---- > Program Files----> Fluent.Inc----->Set environment) That's it and u r done with this.. Remember, If you are using a unix based computer, then a udf compiled on 1 pc may not work with other unix pc as, in case of unix based systems, the system C compiler is invoked and there is no need to install MSVC. Thanks for your patience of reading a lenghthy post and I hope it may be benficial for u. If you dont understand any of the steps, I advice read the steps again and again at the same time practically implementing each step. If you have difficulty still to compile a udf in syntax, u may send it to me directly. All the best Regards Rizwan. |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Dear Sir,
I wrote a udf function by MSVS C++ 2005 to calculate temperature-dependent viscosity as follows; #include "udf.h" DEFINE_PROPERTY(cell_viscosity, c, t) { real mu_lam; real temp = C_T(c, t); real a, b, tempo, muo; a = 0.000178; b = 0.0542; tempo = 323.0; muo = 0.142; mu_lam = muo*exp(a*(temp-tempo)-(b*(temp-tempo))); return mu_lam; } ------------- i go a massage ' the system cannot find the file specified'. (system "copy c:\Fluent.Inc\Fluent6.216\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 file copied. (chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operabe program or batch file. I made a diectory name thin_film, and i put my case file and cell_viscosity.c file in this directory. please help. I need this urgent. Regards, |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
is this your entire udf? u need to chek the looping through cells as far as i guess. r u changing viscotiy of a single cell or a group of cells ??? once you complete this part then go to the compile udf part. also if its not necessary, then i suggest that u go for interpreted udfs as both serve the same purpose except tht things are done differntly in either case and flexibility of dealing with problem.
If compiled udf is mandatory, Did you go through all the steps I stated in my above post? chek with your environment variables, ask your adimistrator to copy the enviornment variables and give it to you and u too define ur environment variables same as that of yours/. Regards |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Also Please be adviced that if u r using udf to modify properties of only single cell, i tested ur udf and its working absolutely fine till compiling and loading state. i dont know tha result provided by it but programming aspect is absolutely correct FOR A SINGLE CELL ONLY. I repeat FOR A SINGLE CELL ONLY not for a group of cells. U need to chek with the installation of MSVS, esp i suggest u use MSVS 6 PRO and modify the environment varialbes properly and set path.
Regards |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Dear Razwan,
I have MS Visual Studio C++ 2007 express. I am looking for the full package, then, i will try your steps. I have Fluent in my computer and i am the administrator. I need to calculate the viscosity for each cell as it is temperature-dependet. the udf should take cell-temperture to calculate the viscosity. I am happy that it is working with you. When i use interpreted udf, it is working ok, but very slow. there is massage 'temp definition shadows previous definition' what does this mean? Regards, |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Ya Rizwan, I too am not able to get full package. and i too use interpret and get the same message 4 times. let me know.
Thanks Rizwan |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Thanks Rizwan,
I got Visual C++ full package, and i have gotten good result. Regards, |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
I dint get you. Can u please explain a bit more clearly? Also i want to mention is that there installing MSDN documentation library eats up computer memory terribly. Just add to my first post on wednesday 21, March that, even without documentation MSVC works fine and I have tested it.
Regards Rizwan |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
The message that i had got while interpreting the UDF was,
temp definition shadows previous definition. that also 4 times and then the file got interpreted. I wanted to know what does this mean? With regards, Sangeeta |
Environment Variables
Dear Rizwan
Can you provide the deatils (commands and variable name) to set the environment variables for MSVS Nadeem |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
Dear Rizwan
I have installed Install Microsoft Visual Studio, I followed all your steps but when I want compiled udf, I got the following error : { 1 fichier(s) copi‚(s). 1 fichier(s) copi‚(s). (system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 fichier(s) copi‚(s). (chdir "libudf")() (chdir "ntx86\2ddp")() Done. "c:/documents and settings/administrateur/bureau/mywork" Opening library "libudf"... Error: open_udf_library: Le fichier spécifié est introuvable. Error Object: () } Knowing that I used the same UDF in function interpreted Udfs . It works very well. Just to ensure the smooth operation of the function compiled UDFs. Please help. I need this urgent. Regards, |
Errors with C++ compiler using VIsual Studio 2008
Hi, i have followed the steps above, but when i try to compile and example UDFfrom the Fluent UDF manual, i get an error that the Microsoft Visual C++ compiler has stopped working. I dont know what to do now, getting Compiled UDFs to work is essential for progress in my PhD, any help would be greatly appreciated. Also when i start the Command line compiler of C++ in visual studio, at the top it says "vcvars32.bat is not recognised as an internal or external command, operable program or batch file" would this have anything to do with it?
|
Hello everyone,
I saw some of our friends are looking for complete Visual Studio. I am using Visual C++ 2008 Express Edition, which is available for free and works perfect to compile UDF's. regards Chetan |
Great, thanks, just trying that now.
Michael |
Still error with Visual C++ express
Hi all, i still get the same error that the C++ compiler stops working when i try to build the UDF. I have set the environment variable as suggested, has anyone else had this problems, does anyone know how this can be solved?
Thanks Michael:) |
guys....i'm trying to compile my udf n i getting this error....any1 can help ??? ihave set environment variable and everything according to the steps explained...
LINK : fatal error LNK1104: cannot open file 'kernel32.lib' |
UDF compilation on Windows and launcher
If you are using FLUENT12.0 and newer, compilation of UDF is lot easier.
1. install FLUENT 2. install MS Visual Studio 2005 or 2008 There is no order who is first installed, FLUENT or Compiler 3. launch FLUENT with the FLUENT launcher, with the proper current working directory, where you have the C files. Compiler path should have been setup automatically 4. do your normal compilation |
Followed the step above, but getting this error,
"Error: open_udf_library: %1 is not a valid Win32 application. Error Object: ()" Please, can anyone help me? |
Thanks a lot, I tried with FLUENT 12 and MS VS 2008 and it worked perfectly
|
Quote:
tanx |
i interpret the udf, thats for boundary condition:):), and so easy!i get this error :confused:!!!! can you help me? :o
cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig-host.h>" "D:\saha2\coupled\89.8 11\kaplan-sepBlade.inlet\coarse-meshed\udf-g\design\89-22.5\pen\pressure.outlet.cpp" error: udf compiler: cannot execute cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfco fig-host.h>" "D:\saha2\coupled\89.8.11\kaplan-sepBlade.inlet\coarse-meshed\udf-g\design\89-22.5\pen\pressure.outlet.cpp" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node0.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.0.c" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node1.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.1.c" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node2.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.2.c" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node3.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.3.c" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node4.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.4.c" cpp -I"C:\Fluent6.3.26.Inc\fluent6.3.26/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/client/src" -I"C:\Fluent6.3.26.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/YAS/AppData/Local/Temp/udfconfig node5.h>" "C:/Users/YAS/AppData/Local/Temp/pressure.outlet.cpp.5.c" |
Can anyone help with a UDF problem
When I open a UDF with fluent sometimes it works, I have MS Visual 2008, and open fluent using the command prompt, and using win xp 32bit. And at other times if I copy this UDF to another folder and try and open it again to run another case it crashes and displays this message
'Error: Fluent recieved a fatal signal (segmentation violation). Error Object: ()' How can I fix this, I don't understand why it works sometimes only, also most of the time I am recieving this error now. Dave |
hi
i m little bit confused in setting up the environment variable..could you please give me the details of environment variables setting...thanks waiting for ur reply...
|
UDF Compile Issues
Good morning,
I am trying to compile a UDF library, here are the steps that I take: Open Visual Studio 2008 x64 Win64 Command Prompt load VCVARSALLam64 change directory to my directory launche either fluent 6.3.26 or fluent 12 in command prompt load batch, properties, sources and tracer files, then load header and build then when I load i get following error message: Opening library "libudf"... Error: open_udf_library: The system cannot find the file specified. Error: open_udf_library: The system cannot find the file specified. Error Object: #f looking at the building of the UDF library: (chdir "libudf")() (chdir "win64\3ddp")() # Generating ud_io1.h batch.c properties.c sources.c ..\..\src\sources.c(308) : error C2275: 'Domain' : illegal use of this type as an expression c:\program files\ansys inc\v120\fluent\fluent12.0.16\src\mem.h(591) : see declaration of 'Domain' ..\..\src\sources.c(308) : error C2065: 'd' : undeclared identifier ..\..\src\sources.c(309) : error C2275: 'Thread' : illegal use of this type as an expression c:\program files\ansys inc\v120\fluent\fluent12.0.16\src\mem.h(691) : see declaration of 'Thread' ..\..\src\sources.c(309) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(310) : error C2275: 'cell_t' : illegal use of this type as an expression c:\program files\ansys inc\v120\fluent\fluent12.0.16\src\mem.h(186) : see declaration of 'cell_t' ..\..\src\sources.c(310) : error C2146: syntax error : missing ';' before identifier 'c' ..\..\src\sources.c(310) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(319) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(319) : error C2065: 'd' : undeclared identifier ..\..\src\sources.c(319) : error C2223: left of '->c' must point to struct/union ..\..\src\sources.c(319) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(319) : warning C4047: '!=' : 'void *' differs in levels of indirection from 'int' ..\..\src\sources.c(319) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(319) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(319) : error C2223: left of '->next' must point to struct/union ..\..\src\sources.c(322) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(322) : error C2223: left of '->nelements' must point to struct/union ..\..\src\sources.c(322) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(322) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(322) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(324) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(324) : error C2223: left of '->storage' must point to struct/union ..\..\src\sources.c(324) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(325) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(325) : error C2223: left of '->storage' must point to struct/union ..\..\src\sources.c(325) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(326) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(326) : error C2223: left of '->storage' must point to struct/union ..\..\src\sources.c(326) : error C2065: 'c' : undeclared identifier ..\..\src\sources.c(327) : error C2065: 't' : undeclared identifier ..\..\src\sources.c(327) : error C2223: left of '->storage' must point to struct/union ..\..\src\sources.c(327) : error C2065: 'c' : undeclared identifier tracer.c Generating Code... cana anyone help? I have set environmental variables and all that stuff with Fluent and MSVS 2009 thanks! |
Sorry I forgot to add :
I am running a 64-bit edition of windows XP with Intel Xeon processor |
Quote:
|
Papteo, thanks for the reply.
The UDF has worked for the person in my position before me. It compiled for him and he was able to get simulation results. However, he is no longer with us so I have tried to recreate any steps he may have tried. Essentially, we have other UDF's that were able to compile using this method, this just adds a 4th source file. Additionally, I get different errors if I use a different compiler, for example, vcvarsall or vcvars32. The majority of the errors for this one is the 'undeclared identifier', whereas the other have 'syntax error', and they do not occcur together. Any thoughts or suggested routes to take? |
UDF not VISIBLE
my udf regardin simulation of wave generation in tank,is built and loaded successfully, but is not shown in dynamic mesh control? can u guide me?
|
Dear Rizwan
Hi I am antikk.Here is what I did to compile UDF(ansys fluent 13.0) in my XP86 pc => I installed(after installation of fluent) VS2010 like you said C:\Microsoft Visual Studio 10.0\.. but no prompt was displayed asking for command line compiler..no reboot.. => In the Environment Variables->system variables->path...I set the value C:\Microsoft Visual Studio 10.0\Common7\Tools;C:\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files\ANSYS Inc\v130\fluent\ntbin\ntx86 => In fluent.inc when I build my udf.c it gives this message > Deleted old libudf\ntx86\2d\libudf.dll 1 file(s) copied. (system "copy "C:\PROGRA~1\ANSYSI~1\v130\fluent"\fluent13.0.0\sr c\makefile_nt.udf "libudf\ntx86\2d\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\2d")() Done. then when I press "load" then it says Opening library "C:\Documents and Settings\antikk\Desktop\dynamic mesh\libudf"... Error: The UDF library you are trying to load (libudf) is not compiled for 2d on the curent platform (ntx86). The system cannot find the file specified. C:\Documents and Settings\antikk\Desktop\dynamic mesh\libudf\ntx86\2d\libudf.dll Error Object: #f If I copy any libudf.dll ansys fluent directory(C:\Program Files\ANSYS Inc\v130\fluent\fluent13.0.0\addons\adjoint\ntx86\ 2d) and try to load then it says.. Opening library "C:\Documents and Settings\Anik\Desktop\try12\dynamic mesh\udf compile test\libudf"... Library "C:\Documents and Settings\antikk\Desktop\dynamic mesh\libudf\ntx86\2d\libudf.dll" opened dasSolutionReset dasInitialize dasIsStale dasAdvance dasUpdateShape dasCheckShapeStatus dasGradient dasModify dasCostValue dasReport dasGetResidualHistory residualHistoryWriter residualHistoryReader resetting updating locations adjustAll reset morphExpectedChange getControlBB printVersion countMemoryLocations naming meshQuality meshAdvance meshReport runTest Done. What should I do now? Can you HELP? PLEASE... ........my apology for this lengthy post |
plz check your mesh and geometry
|
WINDOWS SDk
Quote:
|
What About SDK
Dear Rizwan bhai,
What about the Windows SDK in one of the post i saw that Windows SDK has to be installed and Fluent has to be opened through Windows SDK. SO as per your advice no need to open fluent through SDK we can open it directly? |
I tried that part but did not work for me. Install SDK your fluent will run smoothly.
cheers shiv |
I found some information from a file "ANSYS FLUENT GUIDE Advanced FLUENT User-Defined Functions(2011)".
21.2 How to Set Environment Variables 21.2.1 On Windows 32 Bit • If you are using Windows 32 bit, it’s better to install Visual Studio 2005 (Just install Visual C++, deselect other components) • Then, Go to this address: “C:\Program Files\Microsoft Visual Studio\VC98\bin\” • Double click “VCVARS32.BAT” • Then go the FLUENT install address: “C:\fluent.inc\ntbin\ntx86\” • And double click “setenv.exe” 21.2.2 On Windows 64 Bit • If you are using Window 64 Bit, it’s better to install Visual Studio 2008 (Just install Visual C++, deselect other components) • Then, Go to this address: “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\” ------> This may be wrong. It could be "...\amd64". • Double click “vcvars32.BAT” ------> This may be wrong. It could be "vcvars64.BAT". • Go to the FLUENT install add: “C:\Program Files\ANSYS Inc\v121\fluent\ntbin\win64\” • And double click “setenv.exe” |
Hi all, I face this error while compiling the UDF.
Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64). The operation completed successfully. C:\Users\0wner\Desktop ry ken\libudf\win64\3d_host\libudf.dll Could I know how to solve it? Thank you. |
RPHOST?
Please refer to: ANSYS Help→ Fluent→Customization Manual→ I. Creating and Using User Defined Functions→Parallel Considerations |
Dear SJSW,
Thank you for your respond. But when I run it with serial, the same problem was encountered. The error as below: The UDF library you are trying to load (libudf) is not compiled for 3d on the curent platform (win64). The system cannot find the file specified. c:\users\0wner\desktop ry ken\libudf\win64\3d\libudf.dll At the moment, I think Im facing compiling issue with Window 10. Same approach goes well with Window 7. But not working on Window 10. I have installed Visual Studio 15 and NetFramework 4.5.1. Looking forward for the kind advise. |
I installed VS2015(including c compiler) after ANSYS17 in Win10.
I didn't set up anything after installation. They worked well. In this way, I don't know what is wrong about your installation. @@ |
Ansys udf-silidification problem
1 Attachment(s)
I am working on a solidification project, I want 2 stir the molten metal for 5mins then stop the rotating region from rotating, then open d gate (i.e after 5mins of stir) so that the molten metal can flow out. I want 2 also control d mass flow rate of the solid metal at inlet such that I will introduce it within first 2 mins of impeller rotation i.e first 2 mins of stir.
Pls, I need help in writing d script for 1) d impeller or stirrer motion 2)d gate ctrl 3)mass flow ctrl The total mass of metal is 10kg |
Quote:
Since this is a very old post, I would like to add few more points for the new users. I was stuck with compilation error for almost two weeks. Initially I had an nmake error(most common error) which got solved by setting the system variables correctly. Then compiler showed that my header files are missing. Here is my solution to the problem. (Depending on the platform, windows edition and MSVS edition, this solution may slightly change here and there.) For reducing post length, I am not repeating the steps Rizwan already told. Step1: no change Step2a edit: the latest versions of MSVS (for eg, VS community edition 2017) will take more than 10GB space. Since I did not know which files are required/not required, I downloaded all components (including optional files)which took 34GB space. If you are a programming expert, you may optimize the size on disc. Step2b edit: not required to change default path. step3 edit:No popups/prompts asking to check command line compiler in new versions of MSVS(i do not know about versions older than 2017). Step4,5,6 : no change Step7: Go to windows desktop and search for MSVS command prompt. Open VS2015x64 native tools command prompt(This will depend on your installed MSVS version,OS platform and the processor) Step8: check whether command prompt opens normally. In my case, it showed some error in script usage as "Error in script usage.The correct usage is C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat[option]" This is an issue with the latest MSVS edition. This error may also also come while upgrading from older to newer versions of MSVS. If latest installed/ upgraded MSVS version is 2017 on a 64-bit OS x64 processor, then run this. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat This will set all environment variables correctly. If not 64-bit OS x64 processor, then try running batch files(.bat) similar to "vcvars64.bat" available in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC. (MSVS 2017 edition got installed in MSVS 14.0 folder and the command prompt will be shown as VS2015. Some mysterious way in which microsoft works. I am not a programming expert to tell you why:) ) step9: You will now be in the folder C:\Program Files (x86)\Microsoft Visual Studio 14.0 come out of all sub folders and go to the fluent folder and launch fluent as C:\Program Files\ANSYS Inc\v181\fluent\ntbin\win64>fluent.exe Step10: Fluent launcher will pop up. Change the working directory to your directory. Go to environment tab and make sure that you have the following as your path C:\Program Files\ANSYS Inc\v150<your version>\fluent\ntbin\win64\udf.bat Check the box>>set up compilation environment for UDF Launch fluent. Step:11 Compile your UDF as usual. Add udf file. Make sure that you delete your "libudf "folder from previous attempts from working directory before building. While building, if it shows that some "*.h"(eg, stdio.h is not a programmable file) files are missing, then you need to add one more path to the system variables. C:\Program Files (x86)\Windows Kits\10\Include Because, in latest MSVS editions, the header files are separately put in this folder. Now, repeat steps 7-11. Library will be successfully build. After build, load it. Thats it. Now you can run your case file. It does not matter whether you read case/data file before/ after compilation. Hope it helps someone. |
All times are GMT -4. The time now is 23:18. |