Include moda in a visual C++ windows form application

Questions about Marilou Open Devices Access (MODA)
Post Reply
arismendi
Posts: 7
Joined: Thu Oct 23, 2008 11:20 pm

Include moda in a visual C++ windows form application

Post by arismendi » Mon Feb 23, 2009 11:53 am

Hi! I'm trying to develop a windows form application using visual C++ in Visual Studio 2008 with the .Net framework 3.5, but i don't know how to include the moda library. I tried putting this line $(MARILOU_INSTALL_DIR_SDKS)\Moda\Includes in "Additional Include Directories" of C/C++ project properties and $(MARILOU_INSTALL_DIR_SDKS)\Moda\Libs to the Linker, but i get this errors:

1>AssemblyInfo.cpp
1>Generating Code...
1>Linking...
1>juan.obj : error LNK2028: unresolved token (0A00000F) "public: void __clrcall xkode::lib::ArrayList::Empty(bool)" (?Empty@ArrayList@lib@xkode@@$$FQAMX_N@Z) referenced in function "public: void __clrcall xkode::lib::ObjectsArray<class xkode::lib::String>::Clear(void)" (?Clear@?$ObjectsArray@VString@lib@xkode@@@lib@xkode@@$$FQAMXXZ)
1>juan.obj : error LNK2028: unresolved token (0A000010) "public: void * & __clrcall xkode::lib::ArrayList::operator[](int)" (??AArrayList@lib@xkode@@$$FQAMAAPAXH@Z) referenced in function "public: void __clrcall xkode::lib::ObjectsArray<class xkode::lib::String>::Clear(void)" (?Clear@?$ObjectsArray@VString@lib@xkode@@@lib@xkode@@$$FQAMXXZ)
1>juan.obj : error LNK2028: unresolved token (0A000012) "public: __clrcall xkode::lib::ArrayList::~ArrayList(void)" (??1ArrayList@lib@xkode@@$$FQAM@XZ) referenced in function "public: virtual __clrcall xkode::lib::ObjectsArray<class xkode::lib::String>::~ObjectsArray<class xkode::lib::String>(void)" (??1?$ObjectsArray@VString@lib@xkode@@@lib@xkode@@$$FUAM@XZ)
1>juan.obj : error LNK2028: unresolved token (0A000018) "public: int __clrcall xkode::lib::ArrayList::Count(void)const " (?Count@ArrayList@lib@xkode@@$$FQBMHXZ) referenced in function "public: void __clrcall xkode::lib::ObjectsArray<class xkode::lib::String>::Clear(void)" (?Clear@?$ObjectsArray@VString@lib@xkode@@@lib@xkode@@$$FQAMXXZ)
… (15 more errors like these above)
1>C:\Documents and Settings\Administrator\My Documents\CESAR\Marilou\manfred\juan\juan\Debug\juan.exe : fatal error LNK1120: 18 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\CESAR\Marilou\manfred\juan\juan\juan\Debug\BuildLog.htm"
1>juan - 19 error(s), 0 warning(s)


If I delete this line: #include "Modacpp.h", the program compiles. How can I include moda in this type of project?

LR
Posts: 305
Joined: Mon Feb 12, 2007 11:55 pm
Location: FR

Post by LR » Mon Feb 23, 2009 1:22 pm

Hi,

I think the best way for you is to use the Marilou Wizards (File->New->New From Wizard->Application->Moda) for creating the project automatically.

If you don't use wizards:
If you want to use MODACPP (for using MODA C++ interfaces) you have to add to add moda-xxxxx.lib AND xklib-xxxx.lib (as described in the Programming->Marilou Open Devices Access->MODA C++ documentation topic ;)

If you prefer using Marilou.MODA.dll (Managed MODA version for .net framework, windows forms ...) you just have to add a reference to Marilou.Moda.dll (do not include modacpp.h or others xklib includes).
LR

arismendi
Posts: 7
Joined: Thu Oct 23, 2008 11:20 pm

Post by arismendi » Tue Feb 24, 2009 2:22 pm

Thank you very much for replying so quickly!
I do use wizards and there is wizard for C# Forms application, for MFC and for console, but there is no wizard for C++ forms application.

I solved the problem. I was including the wrong xklib. You were right, that’s specified in the documentation. I apologize. Next time I’ll search better.

Thanks again!

:D

arismendi
Posts: 7
Joined: Thu Oct 23, 2008 11:20 pm

Post by arismendi » Thu Feb 26, 2009 1:32 pm

Hi again! My problem is not solved like I thought it was :( I didn't see this warning:
warning C4627: '#include "ModaCPP.h"': skipped when looking for precompiled header use

Then when I use:

Code: Select all

ModaCPP::Connection *connection=new ModaCPP::Connection(true);
It gives me an error because it is not including moda. Even thought I have Visual Studio 2008 and the documentation says:
Notes
Marilou.Moda.dll only works with the Visual.net 2005 or Visual Express 2005 compilers.
I tried using Marilou.Moda.dll because you suggested to me, but then I get this error:
error C2039: 'Connection' : is not a member of 'ModaCPP'

Please help me with this problem. How can I include moda in a visual C++ windows forms project? Could you create a wizard for this?

Greetings! :wink:

LR
Posts: 305
Joined: Mon Feb 12, 2007 11:55 pm
Location: FR

Post by LR » Thu Feb 26, 2009 2:32 pm

You have to choose if you want to work with
-> Marilou.Moda.dll that is the MODA MANAGED version for using C#, C++ CLI, VB# or J#

-> ModaCPP.lib that is for using in C++ native applications. you cannot use the both libraries into the same project. that's why, because you are working with Windows Forms (managed), i suggest you use Marilou.Moda.dll as a dotnet reference. (do not include ModaCPP.h or others C++ libraries includes, also remove all Modaxxxx.lib and xklibxxx.lib from your project).

<It gives me an error because it is not including moda. Even thought I have Visual Studio 2008 and the documentation says: Marilou.Moda.dll only works with the Visual.net 2005 or Visual Express 2005 compilers>

In fact it works with Visual 2008 too, i have to change this documentation line :)

<I tried using Marilou.Moda.dll because you suggested to me, but then I get this error:
error C2039: 'Connection' : is not a member of 'ModaCPP' >

If you have this error this is because you are using ModaCPP AND Marilou.Moda.dll -> choose one , but the boths.
LR

LR
Posts: 305
Joined: Mon Feb 12, 2007 11:55 pm
Location: FR

Post by LR » Thu Feb 26, 2009 2:34 pm

Take a look at:

[MARILOUINSTALLDIR]\Samples\Devices\ActuatingCylinder\C++ CLI\VC2005
LR

arismendi
Posts: 7
Joined: Thu Oct 23, 2008 11:20 pm

Post by arismendi » Fri Feb 27, 2009 12:11 pm

Thank you very much! :D
You're right about that I was trying to use both. Using MODA MANAGED I was doing this:

ModaCPP::Connection *connection=new ModaCPP::Connection(true);

when in fact I needed to do this:

Moda::Connection ^connection=gcnew Moda::Connection(true);

Thanks again! :D

Post Reply