linking ugopen to visual studio
linking ugopen to visual studio
(OP)
Hi all
Is there a documentation about how to configure visual studio when it tries to link with ugopen? I am currently using visual studio 2012.
when I try to build a simple program using uf functions (only had two functions been called from uf.h, i.e., UF_initialize and UF_terminate), it gives me such errors:
1>------ Build started: Project: NXTest1, Configuration: Debug Win32 ------
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_initialize referenced in function _main
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_terminate referenced in function _main
1>D:\Gan_Software\VisualStudio\projects\NXTest1\Debug\NXTest1.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I use the variables defined by nx, such as, "uf_list_p_t", it works ok. The compiler only gives error msg when it calls the functions from ugopen. I guess the solution could be very simple, maybe it because that it cannot find the source code for the functions and just need to include some library paths. But I tried to include all lib directories in the visual studio, and still doesn't work.
Someone please help!
Many thanks!
Is there a documentation about how to configure visual studio when it tries to link with ugopen? I am currently using visual studio 2012.
when I try to build a simple program using uf functions (only had two functions been called from uf.h, i.e., UF_initialize and UF_terminate), it gives me such errors:
1>------ Build started: Project: NXTest1, Configuration: Debug Win32 ------
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_initialize referenced in function _main
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_terminate referenced in function _main
1>D:\Gan_Software\VisualStudio\projects\NXTest1\Debug\NXTest1.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I use the variables defined by nx, such as, "uf_list_p_t", it works ok. The compiler only gives error msg when it calls the functions from ugopen. I guess the solution could be very simple, maybe it because that it cannot find the source code for the functions and just need to include some library paths. But I tried to include all lib directories in the visual studio, and still doesn't work.
Someone please help!
Many thanks!





RE: linking ugopen to visual studio
www.nxjournaling.com
RE: linking ugopen to visual studio
NX Open Visual Basic (VB) wizard
Creating a Visual Basic project using the NX Open VB wizard
The following topic describes how to develop an NX Open Visual Basic application using Microsoft Visual Studio. It is recommended that all NX Open Visual Basic program development on Windows be done from a Visual Basic project
Starting Visual Studio
You can start Visual Studio by typing "devenv.exe" from an NX command prompt window. Studio will pick up the required NX environment variables necessary to compile and link a project.
Creating a Visual Basic project
Use the Visual Basic wizard whenever you need to create a new NX Open automation program in Visual Studio with the Visual Basic language. The wizard automatically adds the required references to NX Open libraries in the new project.
Using the NX Open VB wizard
To use the NX Open VB wizard:
Step 1. Select the File→New→Project menu item to activate the New dialog box.
Step 2. Under Project Types, expand Other languages and select Visual Basic.
Step 3. Select NX#_VB from the list of Templates (where # is the NX version).
Step 4. Enter a project name into the "Project name:" dynamic input box. By default this becomes the name portion of the program being built. For instance, a project named "MyNXOpenApp" produces either a "MyNXOpenApp.dll" or "MyNXOpenApp.exe". You can override this later, if necessary.
Step 5. Click OK and follow the on-screen instructions to create your Visual Basic project.
?
I have installed both NX and VS2010express, but I have no devenv.exe at all..
What is the problem? What is devenv.exe?
----
kukelyk
RE: linking ugopen to visual studio
Many thanks for your help!
Gan
RE: linking ugopen to visual studio
----
kukelyk
RE: linking ugopen to visual studio
RE: linking ugopen to visual studio
RE: linking ugopen to visual studio
RE: linking ugopen to visual studio
I have similar issues in attempting to link UG (NX7.5) to Visual Studio Professional 2012 (Version 11.0.60610.1 Q11REL). I've copied all network NX files to the VB folders as described below:
• For each wizard, copy any files and/or folders under each subdirectory from the kit to the Visual Studio installation. This example is for the C language so substitute VB or VC# and the appropriate subdirectory for the other languages. Copy:
%UGII_BASE_DIR%\UGOPEN\vs_files\VC\VCWizards\
to
C:/program Files\Microsoft Visual Studio 8\VC\VCWizards\
and
%UGII_BASE_DIR%\UGOPEN\vs_files\VC\vcprojects\
to
C:/program Files\Microsoft Visual Studio 8\VC\vcprojects\
But when I use the NX Command prompt, then change the path to the location of the devenv.exe, then type devenv.exe <return>, it starts Visual Studio as normal and without the NX Wizard. Any suggestions on how to get the NX Wizard within Visual Studio operational?
Thank you for your help.
RE: linking ugopen to visual studio
Using the 2012 version, I started a new project, copied & pasted the boiler plate code from the NX wizards, added references to the NX .dll files, and saved it as a template. Not quite as handy as the code wizards, but it is a workable solution.
www.nxjournaling.com
RE: linking ugopen to visual studio
Since I have not been able to get the NX wizards to run ever, could you please let me know what boiler plate code you used (or which files I might search to locate this initial code) as well as what references used to the NX .dll driver files so I can build my template too?
Thank you once again for your tremendous help.
RE: linking ugopen to visual studio
I most often use the "explicit activation" and "import NXOpen.UF" options; the resulting code looks something like this:
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession 'TO DO: add your code here End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination '----Other unload options------- 'Unloads the image immediately after execution within NX 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately 'Unloads the image explicitly, via an unload dialog 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly '------------------------------- End Function End ModuleFrom the [NX install directory]\UGII\managed directory, the referenced .dll's are:
- NXOpen.dll
- NXOpen.UF.dll
- NXOpen.Utilities.dll
- NXOpenUI.dll
From the .net framework folder, the referenced .dll's are:www.nxjournaling.com
RE: linking ugopen to visual studio
Here is my work around for this issue since Microsoft killed the wizards after 2010:
I downloaded VS2013(Visual Studio), I created a project using the wizard in 2010 Express(Free), imported it into 2013, and exported it as a template. This allows me to run all the code analysis and use full capabilities of projects in VS, I do not have an Author license so I can't sign any of the products of compilation but the .vb file generated from it is exactly what I need for journaling.
This should be able to work for 2012 as well, but I do not have a seed to confirm.
DHuskic
Data Prep NX7.5
Kettering University Class of '17
RE: linking ugopen to visual studio
Thank you again for your awesome help!
Also, thank you DHuskic for your excellent input as well. But for my position at work, we are not allowed to load software (even freeware) onto our workstations. But if worse comes worse, I might see if one of the IT guys can load it with proper approvals and attempt making the modifications as you've suggested. Thank you.
RE: linking ugopen to visual studio
I copied all the Wizard files from UG to Microsoft Visual Studio 10.0.
1) Can someone give me detailed instructions on how to set the MSVCDir environment variable?
When I run NX tools --> comand prompt I get that message MSVCDir environment variable not defined.
It states that i must modify the ufvars.bat file.
I tried modifying but it doesnt work.
Can the MSVCDir be created in regedit ? If yes then where exactly ?
2) Also the devenv.exe is not recognized as a command? How do you fix this?
RE: linking ugopen to visual studio
devenv.exe should be found. If not the installation is incorrect.
Regards,
Mukundh
RE: linking ugopen to visual studio
Express has vbexpress.exe
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\vbexpress.exe