-
-
November 28, 2019 at 7:41 pm
CMCsupport1
SubscriberOne of our subscribers would like to create user-defined functions (UDF’s) in ANSYS using Visual Studio Enterprise 2019. Here are the particulars of the installation.
- Windows 10, 64-bit OS
- ANSYS 2019 R3
- Visual Studio Enterprise 2019 (possibly also 2017)
We found copies of two Knowledge Base solutions (Visual Studio 2017, Visual Studio 2019) and forwarded them to the person, with the *.bat files converted to *.txt files (possible SPAM filter issue). These are #2049257 and #2059458.
Here is a copy of the correspondence.
Regards,
CMC Microsystems' Technical Support staff
-&-&-&-&-&-&-
Original question from user: I have just installed ANSYS. Everything proceeded relatively smoothly, but there is just one problem when I try to run the software. I need to use UDFs written in C. The Visual Studio C compiler is installed on the same drive, but when I try to compile UDF, there is an error message that some standard *.h files are missing. I checked that they are in VS directories, ANSYS just don't see them.
CMC staff: Attached you'll find ANSYS Knowledge Base solutions for ANSYS plus Visual Studio 2017 and 2019.
In ANSYS 2019 R3, our current release, the Help files contain numerous references for incorporating Visual Studio with different CAD modules.
If you need more detailed UDF support, your quickest way would be to post your question(s) on the ANSYS Student Community website, here:
https://studentcommunity.ansys.com/
Registration is free for all academic users. You are able to search other posts there for information, too. All levels of user post there, from professor to IT to undergraduate.
CMC staff follow-up: From Section 2.2 in the ANSYS 2019 R3 Installation manual, you will read that the latest supported version of Visual Studio is 2017.
Attached is a screen capture of the section. Please refer to this guide for more information. Access to the Help files is available with your installation software.
User: With the help of some people from our IT group we are trying to solve this problem, but without a success.
The ANSYS version is 2019 R3, and Visual Studio Enterprise 2019.
For this version I have found another version of the document you have sent us before (attached).
There are two questions:
1. This document recommends Community version of VS not Enterprise I have. Do you think this is important?
2. On the bottom of page 2 it is recommended to download a file "udf_batch_file_2019", which supposed to be attached. Do you know where we could find this file?
CMC staff:
Here are *.rtf copies of the two UDF batch files (-2017 and -2019).
User:
Thank you for your recent messages. The last things we could try is to switch to VS 2017. I will let you know if this works.
Best regards,
CMC staff:
Hello,
You shouldn't have any problems now, Doctor.
FYI - here is a bit more on the 'heap space' recommendation:
https://forum.ansys.com/forums/topic/out-of-heap-space-when-compiling-udf/
User:
Hi,
Unfortunately, my problems continue. The error message now is:
Creating library libudf.lib and object libudf.exp
try.obj : error LNK2019: unresolved external symbol __imp__CX_Message referenced in function _electricprogram
try.obj : error LNK2019: unresolved external symbol __imp__cell_type_nnodes referenced in function _electricprogram
C:PROGRA~1ANSYSI~1v194fluentfluent19.4.0multiportwin64mpisharedmport.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:PROGRA~1ANSYSI~1v194fluentfluent19.4.0win642ddp_nodefl_mpi1940.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
libudf.dll : fatal error LNK1120: 2 unresolved externals
The other question is: do ANSYS and VS should be on the same hard drive? Right now, my VS and Windows are on drive C, but ANSYS on drive D.
CMC staff:
Hello,
ANSYS 2019 R3 is ANSYS 19.5. Your error is reporting a directory path involving ANSYS 19.4 (2019 R2).
Is it possible you have more than one version of ANSYS on your workstation, and are conflating the two installations?
Regardless, I'll post your question and our follow-up to the ANSYS Community, to see if ANSYS engineers have more insight into your difficulties. -
December 2, 2019 at 10:22 pm
tsiriaks
Ansys EmployeeHi CMC staff,
The core error here is
"library machine type 'x64' conflicts with target machine type 'x86'"
which seems to have several different causes but essentially related to VS settings and udf file itself , ref
https://stackoverflow.com/questions/3563756/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ
Please try suggestions/checks on there.
Thanks,
Win
-
December 6, 2019 at 12:44 pm
CMCsupport1
SubscriberGood morning, Doctor,
We've forwarded your suggestion to our subscriber, and pointed him to the outside link you gave us. He is working with his IT department on a solution, as his trouble doesn't seem to be directly related to his ANSYS installation.
My apologies for the delay in acknowledging your reply. Thank you for your patience.
-
December 6, 2019 at 8:14 pm
tsiriaks
Ansys EmployeeThat sounds good. Thank you for the update.
Thanks,
Win
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

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.

Ansys Blog
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.
- License Error
- Error with workbench SceneGraphChart
- How can I renew ANSYS student version license?
- Workbench not opening
- Workbench error
- Sizing on Ansys Workbench 19.2
- Error: Exception of type ‘Ansys.Fluent.Cortex.Cortex not availableException’ was thrown
- Ansys2021R2 ansys212 seg faults immediately on RHEL8.2
- Licensing error while opening ANSYS Mechanical
- An error occurred when the post processor attempted to load a specific result.
-
5204
-
3281
-
2459
-
1308
-
970
© 2023 Copyright ANSYS, Inc. All rights reserved.