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/)
-   -   compiling udf on windows7 64-bit (https://www.cfd-online.com/Forums/fluent-udf/142100-compiling-udf-windows7-64-bit.html)

adi.ptb September 23, 2014 08:56

compiling udf on windows7 64-bit
 
i tried to compile a udf on winx64,i did nearlly everything that was out there but nothing seemd to work for me,i kept getting the"Error:The UDF library you are trying to load (libudf) is not compiled for 2ddp on the current platform (win64)" when i run fluent using visual studio x64 command prompt i had this error: win SDk Dir not found,and using the windows7 SDK cmd shell i had this error:the x64 compilers are not currently installed. after a whole week working on it finallay i found the solution heres what you need and what you should do:
my softwares:Ansys fluent15.0(64bit),Microsoft windows7 SDK.Net framework4.0,visual studio 10 ultimate,VC++ 10 express
set your variables as:
(control panel-->system-->advanced system settings-->environment variables-->system variables-->add)
name:Include
value:

:\Program Files\Microsoft SDKs\Windows\v7.1\Include;C:\Program Files (x86)\Microsoft Visual Studio10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
name:Lib
value:C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
name:Libpath
value: C:\Windows\Microsoft.NET\Framework64\v4.30319;C:\W indo ws\Microsoft.NET\Framework64\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
this the important one
name:path
value:C:\Program Files\ANSYS Inc\v150\fluent\ntbin\win64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Windows\Microsoft.NET\Framework64\v 4 .30319;C:\Windows\Microsoft.NET\Framework64\v2.0.5 0727 ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;"C:\Windows\System32"
the red one is the whole solution
after setting your environment variables run fluent from SDK cmd shell:
start-->all programs-->microsoft windows SDK v7.1-->windows SDK 7.1 command prompt
then go to your working directory where your cas and c files are then copy the address of your working directory for example my working directory is (C:\Users\edi\Desktop\kkk)
in command prompt type:cd (right click and paste your working directory address) for example:cd
C:\Users\edi\Desktop\kkk
press enter then type fluent then press enter
after that read your mesh file and compile your udf
cheers

ana_mg November 26, 2014 13:30

Hi, I also was trying with this modification and adding the same variables:
name:Include
value:c:\Program Files\Microsoft SDKs\Windows\v7.1\Include;C:\Program Files (x86)\Microsoft Visual Studio10.0\VC\atlmfc\Include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Include
name:Lib
value:C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
name:Libpath
value: C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework64\v2.0.5 0727;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib

name: path
value:C:\Program Files\ANSYS Inc\v150\fluent\ntbin\win64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Windows\Microsoft.NET\Framework64\v 4.0.30319;C:\Windows\Microsoft.NET\Framework64\v2. 0.5 0727 ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;"C:\Windows\System32"

Are you sure that the last part is correct? Probably it should be ;C:<working directory> not the "C:\Windows\System32"

Thanks

adi.ptb November 27, 2014 10:10

I'm positive

dtmith March 10, 2015 10:28

Awesome, thanks! I've spent ages trying to get parallel compiling working in Windows 7 64 bit with ansys 15. I've done so many things I'm not exactly sure which ones are necessary, but I used all your environment variables, modified to work with Visual Studio 12 and SDK v7.0 instead of v7.1, I couldn't find and folders labelled "atlmfc" so I left those out but it worked fine anyway.

For people having similar issues, I also followed this (in addition to adding all the environment variables mentioned here)
http://www.simutechgroup.com/CFD/com...5-or-15-0.html

With the slight modification that I ran fluent through the "Microsoft Windows SDK v7.0" command prompt rather than the Visual Studio one.

Now I just have to figure out how to write my UDF to do what I want, but at least it's compiling now!

Ericson June 23, 2015 11:58

Where is the place for adding the variables?
User variables or System variables...

adi.ptb June 24, 2015 03:16

system variables

Ericson November 16, 2015 11:02

I've make my environment variable like yours,, but when i'm trying to compile my udf, i've got this error message :


Copied G:\udf.c to libudf\src
(system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp\makefile" ")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\3ddp")()
# Generating ud_io1.h
udf.c
# Generating udf_names.c because of makefile udf.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj udf.obj
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

What should I do???

ndabir March 7, 2016 21:11

Hi ad,

Thanks for your solution. It worked perfectly for me after struggling with it for a long time. Now I can compile udf with parallel processing. My only concern is that now I have to run fluent through SDK command prompt. Is there anyway I can compile udf in parallel while I start Fluent from workbench?

adi.ptb March 12, 2016 15:20

I think you should do the following:when you run the fluent from the workbench and the fluent panel opens you choose parallel for processing options and then you just do the usual thing for compiling.
Define---->User-Defined---->Functions----->Compiled

ndabir March 14, 2016 12:39

It is not that simple. I have already tried this. When I run the fluent from workbench and compile the udf, I will get this erro:

LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

But if I run fluent from SDk, I can run fluent in parallel with no problem.


All times are GMT -4. The time now is 02:48.