December 12, 2019 at 3:51 pmAriannaSubscriber
I am working to write a UDF that uses external functions to parse a .json file and read velocity data to impose at a domain boundary.
The UDF uses a DEFINE_PROFILE macro. All the headers needed (such as json.h) are included at the beginning of the file.
I launch fluent through Visual Studio as per regular UDF compilation.
However, I get this error:
udf.obj: error LNK 2019: unresolved external symbol
The error refers to the symbols I’m using to parse the .json file and its structure.
It is definitely a linker/compilation error but I can’t figure out how to fix it or if I am missing a compilation step.
Does anyone know how to solve this issue or have experience with a similar error?
Thank you in advance for any suggestion or help!
December 12, 2019 at 4:21 pmDrAmineAnsys EmployeeInclude the header file in the compilation procedure.
December 12, 2019 at 4:32 pmAriannaSubscriber
thank you for your reply! The header file is included (#include) at the top of the UDF file.
I am trying to precomile in visual studio cmd now, with nmake as described here https://www.afs.enea.it/project/neptunius/docs/fluent/html/udf/node133.htm. I am also including this line in the make file:
LIBS = json-c.lib
link $(LIBS)/dll/debug/out:$(TARGET) $(OBJECTS) $(FLUENT_LIB) $(GPU_LIB)
this actually seemed to solve the LNK error. The compilation goes through and the final output is:
# Linking libudf.dll because of makefile user_ntf.udf udf_names.obj boundary_condition.obj
However the libudf.dll file is not created in the folder, and that is what I would need in order to load the UDF in Fluent. DO you have any suggestion?
Thank you again for your help and availability!
December 12, 2019 at 4:51 pmDrAmineAnsys EmployeeIn the compile window add header files. That is all what I can now say on this open community.
December 12, 2019 at 5:03 pmAriannaSubscriber
Thank you again for following up!
I just tried what you suggested, I get the same error LNK2019.
Going through precompilation as described in the link I shared seems the best way so far. Do you have any suggestion about precompiling in order to generaet the libudf.dll file that can then be loaded through user-defined>functions>manage?
Thank you again for your help!
December 12, 2019 at 5:42 pmDrAmineAnsys EmployeeI guess some env variables have not been set and that is why you require running from VS command prompt. Please follow this first
1/compile dummy udf directly in Fluent does it work if not
2/compile from x64 cross VS prompt it should work. Now get the list of environment variables and compare it to the list you get from NORMAL windows command prompt. Focus on Inckude Lib and Path env variables.
December 12, 2019 at 6:44 pmAriannaSubscriber
Thank you again for your help and time!
I believe the enviromental variables have been properly set because I can successfully compile other simple UDFs in Fluent.
I think I didn't explain my problem in the right way. In this specific UDF I'm trying to include external functions to read .json files. I am not required to compile from VS command prompt, the reason why I'm doing that is because I'm trying to pre-compile the UDF and then load it in Fluent (as described here https://www.afs.enea.it/project/neptunius/docs/fluent/html/udf/node133.htm and here https://www.researchgate.net/post/How_to_configure_ANSYS_Fluent_UDF_makefile_for_linking_to_a_static_library_lib) so that I can include external libraries.
The issue I'm running into is that the precomplilation in VS command prompt goes through and the final output is:
but the libudf.dll and libudf.lib files are not generate in the folder. It is a very specific problem I guess, do you have any suggestion?
Thank you again, I really appreciate your help!
December 13, 2019 at 6:13 amDrAmineAnsys EmployeeThen please check more actual help documentation.
- You must be logged in to reply to this topic.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
© 2023 Copyright ANSYS, Inc. All rights reserved.