VS 2010 C++ MFC

Moderator: Telldus

Post Reply
ombrastein
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am

VS 2010 C++ MFC

Post by ombrastein » Thu Jan 18, 2018 11:08 am

Hey

I'm having problems getting the API to work from a C++ MFC dialog app, using VS2010.
Am I missing something obvious? Is it possible to get the Telldus API to work in MFC C++?

What I've done so far is:

1.) Create a standard dialog based MFC app
2.) Added #include "telldus-core.h" to my main dialog class and made sure the compiler finds the file (added it to project). IntelliSense now recognizes the stuff defined in telldus-code.h so i asume this part is ok
3.) Added TelldusNETWrapper.dll to my Linker->Input->Additional Dependencies. Here is where I'm getting unsure. Is this the correct file, included in the correct way?

When i try to compile i get an error saying:
1>LINK : fatal error C1308: E:\Program Files (x86)\Telldus\Development\TelldusNETWrapper.dll: linking assemblies is not supported

Am I missing something obvious?

Thanks in advance for any help :)

ombrastein
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am

Re: VS 2010 C++ MFC

Post by ombrastein » Thu Jan 18, 2018 11:08 am

Made some progress I hope:

I was trying to use the .NET wrapper in an unmanaged MFC project, which i guess i the wrong thing to do.
(I have not tried to mix managed and unmanaged code before, couldnt get it to work now)

Should I be linking directly to the TelldusCore.lib from .\Developmen\x86_64 folder?

I tried that but get an unresolved external error:

1>LabRemoteDlg.obj : error LNK2019: unresolved external symbol __imp__tdInit@0 referenced in function "protected: virtual int __thiscall CLabRemoteDlg::OnInitDialog(void)" (?OnInitDialog@CLabRemoteDlg@@MAEHXZ)
1>F:\PROJECTS\BEDKO\RnD\LabRemote\Debug\LabRemote.exe : fatal error LNK1120: 1 unresolved externals

I have now a very basic MFC dialog app, where i #include the telldus-core.h and have Development\x86_64\TelldusCore.lib listed under additional dependencies in linker input.

Any ideas anyone? Am I going in the right direction, or still doing anything hopelessly wrong?

If anyone has suiccessfully used telldus api in an unmanaged Visual Studio project, I would love to hear from you ...

ombrastein
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am

Re: VS 2010 C++ MFC

Post by ombrastein » Thu Jan 18, 2018 11:08 am

Got it to work.

Turns out my mistake was using the x86_64 .lib.
When i switched to the x386 lib, all is well.

I got my application working agsainst the telldus core lib and i can successfully communicate with my remote devices.

Thanks to anyone who looked at this.

If anyone can offer an explanation why it is wrong to use x86_64 .lib when developing MFC c++ app's, I'd be interested to know.

micke.prag
Site Admin
Posts: 2227
Joined: Thu Jan 18, 2018 11:08 am
Location: Lund
Contact:

Re: VS 2010 C++ MFC

Post by micke.prag » Thu Jan 18, 2018 11:08 am

If you can link with the 32 bit library but not the 64 bit then you application is also compiled 32 bit. Only 64 bit applications can link to 64 bit libraries and vice versa.
Micke Prag
Software
Telldus Technologies

Post Reply