MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
I get the latest MapWinGIS4Dev source code and SupportLibraries, build a release MapWinGIS.ocx, then import it into my project and create a CDMap class. And then I compile my project. 4 errors occur. The VS2008 IDE said that: double mapWindow::IImage::GetOrigin
Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 09, 2010 07:47PM

I get the latest MapWinGIS4Dev source code and SupportLibraries, build a release MapWinGIS.ocx, then import it into my project and create a CDMap class.

And then I compile my project. 4 errors occur.

The VS2008 IDE said that:
double mapWindow::IImage::GetOriginalXllCenter(void)
double mapWindow::IImage::GetOriginalYllCenter(void)
have been defined.
mapWindow::IImage::GetOriginalXllCenter
mapWindow::IImage::GetOriginalYllCenter
have been redefinition, and have different implementation_key.

__declspec(implementation_key(742)) double IImage::GetOriginalXllCenter ( );
__declspec(implementation_key(743)) double IImage::GetOriginalYllCenter ( );
__declspec(implementation_key(783)) double IImage::GetOriginalXllCenter ( );
__declspec(implementation_key(785)) double IImage::GetOriginalYllCenter ( );

And I also Get "MapWinGIS ActiveX 4.8.2 - 32 Bit" from [mapwingis.codeplex.com], and the result is the same.

So what should I do to avoid it or is it a bug?

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: shevc07 ()
Date: December 11, 2010 12:33AM

I have the same problem, everything are same to you: VS2008, download the MapWinGIS4Dev source and SupportLibraries, release a .ocx, and import into my project got the same wrong, and I also tried the 4.8.2 like you did, and got same wrong.

Can somebody give help?

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: pmeems ()
Date: December 14, 2010 01:19AM

Did you recreate the axinterop and interop dlls?
Perhaps you should delete those and let VS2008 recreate them.

I must say I don't have much experience with C++ I'm more a C# guy ;)

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 14, 2010 07:24PM

I'm sorry that I have no idea of how to recreate the axinterop and interop dlls.
Can you show me the way because I am a little fresh man of it.

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: pmeems ()
Date: December 17, 2010 01:11PM

I've just committed the weekly build, so you can use the ocx and interop dlls from svn.mapwindow.org/svnroot/MapWindow4Dev/Bin/

Let us know if that is solving your problems.

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 18, 2010 11:45PM

I am sorry to report that the new MapWinGIS.ocx can not be registered in OS Win7.
When excuting regMapWinGIS.cmd it gives me a warning that "MapWinGIS.ocx has been loaded, but DllRegisterServer failed. see code 0x80040200."
I just have a computer with OS win7 and a virtual machine with XP, and XP without VS2008. And MapWinGIS.ocx can work correctly in XP.



Edited 1 time(s). Last edit at 12/18/2010 11:46PM by atubar.

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 19, 2010 06:32AM

I install VS2008 in XP, and run the new ocx, the result is the same with before.

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: pmeems ()
Date: December 21, 2010 01:08PM

Download this file (http://svn.mapwindow.org/svnroot/MapWindow4Dev/Bin64/regMapWinGIS.cmd) into the folder you've got the ocx in.
Run it as an Admin (in Win7, right-click on the file and select 'Run as Admin')

This command file will work for the 32-bit version of the OCX as well as for the 64-Bit version.

Did you also copy the dependencies to the folder you've got the OCX in?
These files are mandatory:
gdal17.dll
geos_c.dll
IndexSearching.dll
libecwj2.dll
log4net.dll
lti_dsdk_dll.dll
proj.dll
xerces-c_3.dll

Let me know if it works.

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 25, 2010 02:42AM

After downloaded regMapWinGIS.cmd, runned it as you said, the ocx registered correctly, but in my mfc programme, the ocx still gave me the warings as before.

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: pmeems ()
Date: December 28, 2010 05:33AM

You're sure you don't have multiple copies of the ocx on your machine right now?

I'll ask Sergei if he has some answers. He's the C++ guru.

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: Sergei ()
Date: December 28, 2010 10:16AM

Atubar,

I've just tried to import my current version MapWinGis in MFC application:
Project->Add class->MFC class from ActiveX control->From file->Choose interfaces (_DMap, IImage).

CDMap and CImage were created ok. When building I got error for CImage::BuildOverviews method only. SAFEARRAY parameter wasn't interpreted right. I think it's possible to fix. I simply commented the method.

The instance of the map control was created all right. Red line was draw as well. The code is below.

if (!m_map.Create(L"mapWnd", WS_CHILD | WS_VISIBLE, CRect(100, 100, 200, 200), this, WINDOW_ID))
{
	AfxMessageBox(L"Failed to create map");
	return -1;
}
else
{
	int handle = m_map.NewDrawing(0);
	m_map.DrawLine(0.0, 0.0, 100.0, 100.0, 1, RGB(255, 0, 0));
	m_map.Redraw();
}

How can I reproduce the error? Have you tried just to comment the wrong methods?

2Paul: it doesn't make sense to call me like this. I have some experience with MapWinGis but have never tried MFC. So better not to confuse people ;)
BTW, there was sample MFC project somewhere on the site. Any idea how can I find it?

Regards,
Sergei

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: December 29, 2010 06:01AM

Indeed I have many copies of MapWinGIS.ocx on my computer.

Now I update the svn, copy regMapWinGIS.cmd from ..\MapWindow4Dev\Bin64 into ..\MapWindow4Dev\Bin, and then run it as administrator,and the latest version ocx from ..\MapWindow4Dev\Bin install successfully.

I import MapWinGis in MFC application like this:
Project->Add class->MFC class from ActiveX control->From registery->Choose interfaces (_DMap).

And then add a line in stdafx.h like this below:
#import "..\MapWinGIS\MapWindow4Dev\Bin\MapWinGIS.ocx" rename_namespace("mapWindow") rename("GetObject", "MapWinGISGetObject")

After that, I compile the project. And the warning repeat once more.



Edited 3 time(s). Last edit at 12/29/2010 06:28AM by atubar.

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: February 19, 2011 05:46AM

Hi, I get the latest code from svn, and find that the problem still there.
As a freshman I've no idea about how to solve it, so can anyone give me some advice?

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: angus966 ()
Date: February 21, 2011 07:40AM

I used the following import statement in my stdafx.h file:-

#import "C:\Program Files (x86)\mapwindow\MapWingis.ocx" raw_interfaces_only

This gave me a clean compile and I was able to access the IShapefile interface with the following:-

MapWinGIS::IShapefilePtr pShape;
pShape.CreateInstance(__uuidof(MapWinGIS::Shapefile));
MapWinGIS::ICallbackPtr pBack;
VARIANT_BOOL success;
pShape->Open(_T("c:\\program files (x86)\\mapwindow\\sample projects\\newton\\GIS\\shapefiles\\newton.shp"), pBack, &success);
m_MapWin.AddLayer(pShape, true); // m_MapWin is instance of CMap


Let me know if this helps

Options: ReplyQuote
Re: Function Redefinition in mapwingis.tlh in a MFC(no clr) project
Posted by: atubar ()
Date: May 12, 2011 03:09AM

Thanks to angus966 for your help.
As you said, now there is no warnings and errors while compiling.

Options: ReplyQuote


Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: