Hi Arjen, Alan
Sorry I've been so busy at work this week I haven't kept up with this.
Arjen you are absolutely correct, you cannot mix libraries built with /MT /MD /MTd and /MDd. Every library you build into an executable must use the same runtime library - if you don't stick to this rule then you will get awful and difficult to track down linker errors. The same is true to some extent of the character set - if you have one library which uses wxString or std::string and is built as unicode and try to mix with another non built with unicode then project will not link. In both cases missing and or clashing symbols will be the issue. Spotting these link errors is not always easy, but look out for mention of debug or string related errors and this is often a
clue. Having a file with DEBUG or NDEBUG incorrectly defined can cause similar problems. This was a bug I reported to Alan last week. Are you generating a visual studio project from cmake? If so check the preprocessor definitions for each file for incorect definitions.
These linker errors are the reason why I've been pushing to enable static runtimes in plplot and also why I was asking about unicode a while back too. By default I build everything against the static runtime (and with unicode) because it means that I can give a compiled exe to anyone and it will run on their windows box. I can't build some libraried with /MT and plplot with /MD because it causes all these link errors.
My strategy to deal with this is to use similar naming conventions to wxWidgets. append s for static, u for unicode, d for debug. There is some ambiguity with s for
static runtime or static vs dynamic library, but I made a descission that I'd always create static libraries linked against the static runtime and dlls with the dynamic runtime so that's okay for me.
How are you getting wxWidgets? I used wxPack - just google it. This contains visual studio project file with 12 configurations (4 static, 4 dll, 4 universal dll - I don't know what the universal dll configurations are as they don't build for me). I changed the static configurations from /MD and /MDd to /MT and /MTd, so I get a static library linked against the static runtime. You could instead copy any configurations you need to edit. Go to Tools, Configuration Manager, then under active solution configuration select new. Give the new configuration a name and select which existing configuration to copy from. This is all based on Visual studio express 2008 by the
If you want to try playing with shapelib as Alan suggested then you can use cmake to build it, however the code is just plain C I think so you can just create a new lib/dll solution and add the files. I'm pretty sure that's all I did. Then you can play around with the settings in visual studio if you like.
But just remember the fundamental rule when liking libraries with visual studio. Make sure the runtime library and character set are the same for all libraries and your final exe.