Page 1 of 1

Visual Studio 2013 Compilation Issue

Posted: Thu Oct 30, 2014 3:35 pm
by mmcc
Hi everyone,

I have copied the source for simplebot to a new folder, upgraded it to a Visual Studio 2013 project and compiled. No errors, no warnings. But when selected in the main game, it throws a a general error:

"This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information."

I ran a debug session and captured this error being thrown:

First-chance exception at 0x76802F71 in defcon.exe: Microsoft C++ exception: std::length_error at memory location 0x0018F8DC.

Here is the relevant stack:

KernelBase.dll!76802f71() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
[External Code]
> MarxDefconBot.dll!AI_init(Funct * _functions, std::vector<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::allocator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > > _commandLineOptions) Line 42 C++
defcon.exe!004a96aa() Unknown
[External Code]
defcon.exe!004efcb7() Unknown
defcon.exe!004a837a() Unknown
defcon.exe!004a837a() Unknown

Has anyone seen this before, or have a potential solution?

Re: Visual Studio 2013 Compilation Issue

Posted: Thu Oct 30, 2014 4:07 pm
by mmcc
A little digging appears to suggest that passing STL objects, such as std::strings, causes errors when the main application and DLL have been compiled against different runtimes.

Two solutions exist:

a. Introversion recompiles Defcon against VS2013
b. I recompile the DLL using VS2005/2008 or find an older Windows SDK.

In the short-term, I will explore option B, but if Introversion wishes to maintain the ability to develop custom AI solutions, which I would very much like to see, then they must explore option A.

If I can get this to work, I will post the instructions here.

Re: Visual Studio 2013 Compilation Issue

Posted: Thu Oct 30, 2014 5:22 pm
by mmcc
I found a temporary solution in installing Visual C++ Express 2008. Download the file from Microsoft here:

Now switch the compiler in VS2013:

1. Right click the project and select 'Properties'.
2. Under 'Configuration Properties' select 'General'
3. Change 'Platform Toolset' to 'Visual Studio 2008 (v90)'
4. Build

If everything goes to plan, the newly built DLL will work fine in Defcon.

This will ensure that Defcon AI DLLs can be built on the latest platforms (Win 8.1/Win Server 2012 R2), but it remains to be seen if that will still be the case with the release of Windows 10 and the next version of Visual Studio. Hopefully Introversion will rebuild the main application if backwards compatibility cannot be maintained.