level 1
自强😁不息
楼主
#在fluent里面编译UDF失败, 报错信息如下所示。
解决方案,网上很多经验贴,不胜其烦。
visual studio装了又卸载,卸了又安装。环境变量也添加了,也确保visual studio和fluent装在了同一个盘。然而,然而不解的是,按照Functions-Compiled-souece file name(选择自己的UDF文件,例如filename.c)-Build。还是会报错。
解决方案!!!最后发现!!!UDF里面的中文注释似乎有影响,把注释删除,然后Functions-Interpreted-souece file name(选择自己的UDF文件,例如filename.c)-Interpret。这个时候UDF文件就能正常读取并使用了。
下图是interpret之后的信息:

这是built报错的信息:
“scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 20, in <module>
Compiler path: "C:\PROGRA~1\ANSYS2~2\ANSYSI~1\v231\fluent"\ntbin\clang\bin\clang-cl
Linker path: "C:\PROGRA~1\ANSYS2~2\ANSYSI~1\v231\fluent"\ntbin\clang\bin\lld-link
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 156, in <module>
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 296: illegal multibyte sequence:
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 180:
generate_udf_source(t, s, env)
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 91:
for line in f:
Done.”
2023年12月21日 19点12分
1
解决方案,网上很多经验贴,不胜其烦。
visual studio装了又卸载,卸了又安装。环境变量也添加了,也确保visual studio和fluent装在了同一个盘。然而,然而不解的是,按照Functions-Compiled-souece file name(选择自己的UDF文件,例如filename.c)-Build。还是会报错。
解决方案!!!最后发现!!!UDF里面的中文注释似乎有影响,把注释删除,然后Functions-Interpreted-souece file name(选择自己的UDF文件,例如filename.c)-Interpret。这个时候UDF文件就能正常读取并使用了。
下图是interpret之后的信息:

这是built报错的信息:“scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 20, in <module>
Compiler path: "C:\PROGRA~1\ANSYS2~2\ANSYSI~1\v231\fluent"\ntbin\clang\bin\clang-cl
Linker path: "C:\PROGRA~1\ANSYS2~2\ANSYSI~1\v231\fluent"\ntbin\clang\bin\lld-link
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 156, in <module>
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 296: illegal multibyte sequence:
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 180:
generate_udf_source(t, s, env)
File "C:\DHF\condensation work restart\example\libudf\win64\2ddp_node\SConstruct", line 91:
for line in f:
Done.”









