|
[Sponsors] |
July 28, 2021, 09:43 |
[Help] Error complier UDF Fluent C++
|
#1 |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
Hi Guys! I'm a student. I tried defining the UDF properties of steam follow IF97. But When I Complier I Had an error :
\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\src\u e -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\s rc\dpm -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\s rc\dbns -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\c ortex\src -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\c lient\src -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\t grid\src -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\m ultiport\src -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\fluent21.1.0\m ultiport\mpi_wrapper\src -I"C:\PROGRA~1\ANSYSI~1\v211\fluent"\include ..\..\src\testif97.cpp ..\..\src\IF97.h Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x64 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9024 : unrecognized source file type '..\..\src\IF97.h', object file assumed cl : Command line warning D9027 : source file '..\..\src\IF97.h' ignored testif97.cpp C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt\sys/stat.h(239): error C2375: '_stat64i32': redefinition; different linkage C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt\sys/stat.h(185): note: see declaration of '_stat64i32' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.EXE"' : return code '0x2' Stop. Done. Can you help me fix it?. Thankfully! |
|
July 28, 2021, 13:16 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What is in IF97.h?
Normally, I never add a header file...
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 28, 2021, 22:08 |
|
#3 |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
I already copied the header file to the \fluent\fluent21.1.0\src folder. But when I compile I still get the following error:
Code:
testif97.cpp C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt\sys/stat.h(239): error C2375: '_stat64i32': redefinition; different linkage C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt\sys/stat.h(185): note: see declaration of '_stat64i32' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.EXE"' : return code '0x2' Stop. |
|
July 29, 2021, 00:52 |
|
#4 |
Senior Member
Lolita
Join Date: Aug 2016
Posts: 118
Rep Power: 10 |
its showing Nmake error, why don't you try in-built compiler
|
|
July 29, 2021, 02:32 |
|
#5 |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
||
July 29, 2021, 02:58 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Have you successfully compiled UDFs in the past, or is this the first time you try it (on this computer)?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 29, 2021, 03:19 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
looks like there is some problem with compiler, may be x32 x64 version problem
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 29, 2021, 05:17 |
|
#9 |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
||
July 29, 2021, 06:58 |
|
#10 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
||
July 29, 2021, 07:22 |
|
#11 |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
||
July 30, 2021, 02:43 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
call your udf as *.c file and compile
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 22, 2023, 10:29 |
Solved?
|
#14 |
New Member
xicheng wang
Join Date: Sep 2019
Posts: 3
Rep Power: 7 |
Hi, cudau.95
Have you finally solved this issue? I also want to include IF97 in my UDF but meet the same error. Best regards, Xicheng |
|
July 6, 2023, 10:26 |
Is anyone able to find a solution? Need help asap
|
#15 |
New Member
Join Date: May 2020
Posts: 21
Rep Power: 6 |
Hi folks,
I'm trying to build and load my UDF in Fluent 2023 R1. I have tried installing Visual Studio 2019 Professional and Visual Studio 2017 Community. The error still persists. I have compiled UDFs successfully in Fluent before and I've made necessary changes in the "Environment Variables" path in 'This PC' but to no avail. I've had faced the infamous 'nmake error' that plagues a lot of people and I managed to fix that by making the changes I mentioned earlier. The strange part of this is that for whatever reason the UDF compiles, builds and loads with no problem on my laptop but it doesn't on my PC. I've made the exact same changes on them both, both run Windows 10, both have the same Visual Studio version (2017), with the only difference that the desktop PC has a Fluent 2023 R1 version while my laptop has Fluent 2022 R1 version. The error I get when trying to build the UDF is: NMAKE : U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bi n\HostX86\x64\cl.EXE"' : return code '0x2' Stop. The UDF is coded in 'C' and works flawlessly on my laptop so I know that the code is not the problem. Kindly help as soon as you can ! Thanks a lot! Last edited by SSG_NJ; July 6, 2023 at 12:08. |
|
July 6, 2023, 12:07 |
NMAKE: U1077 .... return code '0x2'
|
#16 |
New Member
Join Date: May 2020
Posts: 21
Rep Power: 6 |
Can you please see the post I made above about the same error and see if you could help me please?
I just tried with Visual Studio 2022 Community Edition but the error still persists as can be seen in the attached screenshot. I should also mention that apart from changing the Path in Environment Variables, I also tried launching Fluent via the "Cross Tools" command prompt of Visual Studio - both x86 to x64 and x64 to x86. Even that didn't help either! Last edited by SSG_NJ; July 6, 2023 at 15:26. |
|
July 6, 2023, 15:23 |
Solution
|
#17 |
New Member
Join Date: May 2020
Posts: 21
Rep Power: 6 |
I was FINALLY able to figure it out after trying out almost everything that is known.
This applies to Fluent 2023 R1 which is what I'm working on 1. Install Visual Studio 2017 Community edition (This link works as of today 6-Jul-2023: https://visualstudio.microsoft.com/t...mmunity&rel=15 ) [2019 version might also work, I'm not sure] 2. Ensure Universal Windows Platform development and Desktop development with C++ are installed in Visual Studio. These are the ONLY two main packages you need. Keep the default individual components checked and ONLY add Windows 8 SDK as the extra component (you'll find this under 'Desktop development with C++') and install and launch Visual Studio 2017 3. Restart the system (not absolutely necessary but just in case) 4. Change the UDF file extension from .c to .cpp 5. Build and load the .cpp file in Fluent And Presto!... Fluent now compiles your code. Took me 11 hours or so of grueling troubleshooting but it finally works! Enjoy! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to run fluent from matlab without using aas toolbox? | artemis96 | ANSYS | 7 | May 23, 2022 13:16 |
Fluent UDF for moving laser heating of a solid block | Cooper24 | Fluent UDF and Scheme Programming | 7 | July 9, 2021 06:56 |
Problem running fluent with udf on batch | tobi b. | Fluent UDF and Scheme Programming | 3 | April 14, 2016 14:54 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
fluent UDF external library lapack problem | Rick | FLUENT | 0 | May 7, 2008 11:16 |