zstar3 using zstarlib.dll in Visual c++

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

zstar3 using zstarlib.dll in Visual c++

2,620 次查看
acylum
Contributor I
Does anybody have source code on how to use zstarlib.dll in a Visual C++ project.

Because there is not any .lib or .h included with the zstarlib.dll, I'm assuming that the zstarlib needs to be loaded explicitly.

What I am not sure about is how to initialize these classes from the DLL:

ZStar3 theZStar = new ZStar3();
ZStarSensor theSensor = null;


标签 (1)
0 项奖励
回复
5 回复数

845 次查看
wave100
Contributor I

I am having the exact same problems. Even when using your suggestion Gargy, I can't compile ExampleApp in C#. Could you give exact instructions in how to change the library path.

 

These are the errors I get:

 

c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning : The referenced project '..\zstarlib\zstarlib.csproj' does not exist.  (When I click on this error, I get sent to the 'Microsoft.Common.targets' file and to the very first line '<!--'). Do I need to do anything in this file?

C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport: prompt /warn:4 /define: DEBUG;TRACE /reference: C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference: C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out: obj\Debug\ZStarLib_ExampleApp.exe /resource: obj\Debug\ZStarLib_ExampleApp.ZSTARLIB_EXAMPLE.resources /resource: obj\Debug\ZStarLib_ExampleApp.Properties.Resources.resources /target:winexe /win32icon: dgmain.ico ZSTARLIB_EXAMPLE.cs ZSTARLIB_EXAMPLE.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs

 

 error CS0246: The type or namespace name 'zstarlib' could not be found (are you missing a using directive or an assembly reference?)

 

 error CS0246: The type or namespace name 'ZStar3' could not be found (are you missing a using directive or an assembly reference?)

 

error CS0246: The type or namespace name 'ZStarSensor' could not be found (are you missing a using directive or an assembly reference?)

Compile complete -- 3 errors, 0 warnings

 

 

 

Also, I want to translate the ExampleApp code into C++, but I can't seem to add or use the library, 'zstarlib.dll'. I am just adding in into an empty Visual Studios 2008 console application, using:

 

#include "zstarlib.dll"

 

Is there another method to do so, so that I can use the zstarlib commands in C++, instead of C# and can get acceleration data out and placed into a text file, or something similar.

 

Thanks very much.

 

0 项奖励
回复

845 次查看
wave100
Contributor I

I have complied the program in C#. Just remove 'zstarlib' in the 'References' section, by right clicking on that directly and then in the same way, add it back to the 'References'. Thanks very much Gargy:smileyvery-happy:

 

But I now have the problem as to how to add 'zstarlib.dll' into a console application in Visual Studios 2008 C++, so that I can use the functions in this library in C++. Any help will be appreciated.

0 项奖励
回复

845 次查看
Gargy
NXP Employee
NXP Employee

Hi,

 nice to hear that lib works under C#.:smileyhappy:

But I'm afraid that I can't help you with C++, because I'm more embedded programmer than PC.

 

Sorry

0 项奖励
回复

845 次查看
Gargy
NXP Employee
NXP Employee

Hello,

 in example application is small bug in project paths. Sorry 

But the fix is very simple, only delete reference to zstarlib library and then add this library to project back, that's all.

 

And C++ problem:

The library was developed in C# .NET , but I think that this library should work under C++ normally without any additional files.

 

Have a nice day

0 项奖励
回复

845 次查看
u_crd
Contributor I
I am having a similiar issue.  Cannot compile the ZStarLib_ExampleApp because it does not recognise the namespace FreeScale.ZstarLib and hence the library in the .dll.  I am using C# since that is the code they provided for the ZStarLib_ExampleApp and implimenting in Visual Studio 2008. 
 
Has anyone else had this issue or complied the ZStarLib_ExampleApp succesfully?
 
 
Best Regards,
Roger
0 项奖励
回复