Ansys Products

Ansys Products

Co-installation: ANSYS 2019 R3 with Visual Studio Enterprise 2017/9

    • CMCsupport1

      One 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.



      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:

      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).


      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:



      You shouldn't have any problems now, Doctor.

      FYI - here is a bit more on the 'heap space' recommendation:




      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:


      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.

    • tsiriaks
      Ansys Employee

      Hi 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

      Please try suggestions/checks on there.



    • CMCsupport1

      Good 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.





    • tsiriaks
      Ansys Employee

      That sounds good. Thank you for the update. 



Viewing 3 reply threads
  • You must be logged in to reply to this topic.