Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Declare all the motion functions in visual c++?

Hi,

I am new to all this so I was wondering if anyone can guide me to the right direction. I am trying to include the libraries, which gives me access to functions such as flex_initialize_controller(), flex_start(), etc.

If anyone knows how to do that with Visual C++ that would be GREATLY appreciated. I already installed measurement studio for VC++ and all the libraries. Just need to konw how to use them with conjunction with the conventional way of adding *.cpp files in VC++. Thanks !!
0 Kudos
Message 1 of 13
(7,306 Views)
Take a look at the C examples that install with NI-Motion under:

C:\Program Files\National Instruments\NI-Motion\FlexMotion\Examples\C

The include files are located here:

C:\Program Files\National Instruments\NI-Motion\FlexMotion\Include

Hopefully that helps you out - good luck with your projects!
0 Kudos
Message 2 of 13
(7,290 Views)
Thanks Marc!

I have already included the path into VC++.
But when I compile I am getting this error:

error LNK2001: unresolved external symbol "int __stdcall flex_enable_axis(unsigned char,unsigned char,unsigned char,unsigned short)" (?flex_enable_axis@@$$J216YGHEEEG@Z)

Also, when I use the function flex_intialize_controller, I get this error:

error C3861: 'flex_intialize_controller': identifier not found, even with argument-dependent lookup

The compiler isn't liking the use of any of the flex functions available under the flexmotn.h file. I am soo confused. I am linking correctly too.
0 Kudos
Message 3 of 13
(7,294 Views)
Have you included the FlexMS32.lib file also? It is located:

C:\Program Files\National Instruments\NI-Motion\FlexMotion\lib\Microsoft

If that doesn't work - let me know all the files you have included and the simplest code you still have the problem with.
0 Kudos
Message 4 of 13
(7,275 Views)
Hi Marco,

To answer your question, Yes, I was including the library path also. I am sure all the include paths and library paths are correct, because the other flex functions actually compile. It is only flex_intialize_controller. I have included a more simpler code to see what error I am talking about. It is a VC++ project.
Again, I am still getting the identifier not found error.
Thank you very much for your efforts. I greatly appreciate it.
0 Kudos
Message 5 of 13
(7,265 Views)
Oh,
Sorry. I forgot to mention all the paths I include my include/library functions. They are are all pretty much the default paths. Here they are.

Include:
C:\Program Files\National Instruments\MeasurementStudio70\VCNET\Include
C:\Program Files\National Instruments\NI-Motion\FlexMotion\Include
C:\Program Files\National Instruments\MeasurementStudio70\VCNET\Instr
C:\Program Files\National Instruments\NI-Motion\FlexMotion\Examples\C\Includes
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
C:\VXIPNP\WinNT\Include

Library:
C:\Program Files\National Instruments\MeasurementStudio70\VCNET\Instr
C:\Program Files\National Instruments\NI-Motion\FlexMotion\lib\Microsoft
C:\Program Files\National Instruments\MeasurementStudio70\VCNET\Lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
C:\VXIPNP\WinNT\Lib\Msc

I hope this helps. Let me know if you have anymore questions. Thank you very much!
0 Kudos
Message 6 of 13
(7,265 Views)
I created a simple program in both .NET C++ and VC++ 6.0 and all the code I had was:

#include "flexmotn.h"
#include "stdio.h"

void main(void)
{
printf("Testing Flex intialize\n");

flex_initialize_controller(1,0);

}

I also had to add the FlexMS32.lib file as a resorce file and the flexmotn.h file as an include file to my project as well as set the include directory path for flexmotn.h in the "additional include directories" under the options menu.

Hopefully those steps get you going.

Message Edited by MarcoPolo5 on 06-24-2005 12:09 PM

0 Kudos
Message 7 of 13
(7,266 Views)
Hi Marc,

Thank you very much for your efforts. I ran your code and it compiled. For some reason the compiler does not like it when I have the #include "flexmotn.h" in *.h file and flex_initialize_controller in my *.cpp file, which was giving me the identifier not found error.
To this moment, I still do not know why.
I changed my code so that I call flex_intialize_controller in my *.h file and it compiles. Thank you very much for your efforts. Greatly appreciated. Have a great day.

-Mike
0 Kudos
Message 8 of 13
(7,253 Views)
 Dear member of the forum we are trying to develop an application using the PCI ni 7354 control board. We want to do it in visual C++.

We installed the Ni-Motion 7.4 software were we found the lib files for flex motion.

The first try was to build a simple program in win32 console (we use the Visual Studio 2005). We tried what you suggest in this forum message. We could link the library with no problem, when we added the #include "flexmotn.h" line and try to compile, we got 291 errors all in the file flexmotn.h. We think this might be because we need to add some defines to the project or something like that. Could you help us?

Thanks in advance.
0 Kudos
Message 9 of 13
(6,739 Views)
Hi uftk,

Thank you for using our discussion forums.  In regards to your issue, have you tried running the C examples listed above? If those are working we can use that as a starting point for building your program.

 http://zone.ni.com/devzone/cda/tut/p/id/3274#6

Regards,
Vu D
Applications Engineer
0 Kudos
Message 10 of 13
(6,711 Views)