mapbox / windows-builds

DEPRECATED! build scripts for mapnik dependencies, mapnik, node-mapnik, node, libosmiom, osmium-tool
38 stars 22 forks source link

Mapnik with MFC #101

Open TFreudi1 opened 7 years ago

TFreudi1 commented 7 years ago

I build mapnik with vc2015 from source and the console rundemo.cpp runs fine, but than I try to put the code in a simple windows-mfc-app it compiles fine but when it comes to the line Map m(800, 800); the object m has only width,height intialized the other members of m are not initialized, in den console app rundemo.cpp this different. In the next program line after the declaration of m, no matter what commands follow, the App crashes with "bad allocation". Looks like the constructor of Map have a problem but I did'nt see anything wrong in trace window, he loads all DLL's fine like the console app.

Thomas

TFreudi1 commented 7 years ago

In Release Mode it works, all members of mapnik::Map are properly initialized, and mapnik renders fine. I tried the whole weekend, compare all compiler switches but in Debug Mode all Mapnik structures are badly initialized and the first attempt to call any memberfunktion of Map ends in a exception "bad allocation". I keep going on I have a feeling that ist has something to do with the namespace std and std:string. It looks like it is different in DEBUG and RELEASE Mode.

wilhelmberg commented 7 years ago

@TFreudi1 you cannot mix Debug and Release DLLs/programs.

If you built mapnik with windows-builds you created Release DLLs - we deactivated Debug builds a while ago because they crashed Visual Studio.

So your MFC program has to be Release too.

TFreudi1 commented 7 years ago

But rundemo.cpp, the console application compile and run in both modes fine It only happens when I add MFC and make the subsystem Windows. Also I have a lot of other projects where i use DLL's made for Release but the program itself is a Debug version, I can't Debug into the DLL Code thats true, but it runs fine and I guess for example the MFC-DLL's are always Release mode build's, I can't believe what you are saying. I'm a bit further now it has to do with std::string, this type is handled differently in Release and Debug mode.