Compiling With Microsoft Compiler

Derek Magee D.R.Magee at leeds.ac.uk
Sat Mar 30 11:43:30 EDT 2013


Hi,

I'm trying to get the simple program below compiled using microsoft 
visual c++ from the command line. It works fine with debug information 
included (/Zi), but with this omitted the program links, but crashes at 
runtime. I'm using the latest windows 64bit precompiled binaries on 
windows 7, MSVC 2010. Any thoughts? I'm completely stuck.

Thanks

Derek

=== Code ===
#include <openslide.h>
#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
     cerr << "Prog started" << endl ;

     if(openslide_can_open(argv[1])){
         cerr << "Can open" << endl ;
     }
     return 0;
}

== Compile with Debug, compiles and runs fine ==

D:\....>cl DRMTest.cpp /I 
d:/.../openslide-win64-20120908/include/openslide  
d:\...\openslide-win64-20120908\lib\libopenslide.lib /Zi
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

DRMTest.cpp
C:\Program Files (x86)\Microsoft Visual Studio 
10.0\VC\INCLUDE\xlocale(323) : wa
rning C4530: C++ exception handler used, but unwind semantics are not 
enabled. Specify /EHsc
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:DRMTest.exe
/debug
DRMTest.obj
d:\..\openslide-win64-20120908\lib\libopenslide.lib

D:\..\openslide-win64-20120908\DRMTest\DRMTest\DRMTest>DRMTest.exe
D:\...\44598.svs
Prog started
Can open

== Without debug information, it compiles, but crashes ==

D:\..\openslide-win64-20120908\DRMTest\DRMTest\DRMTest>cl DRMTest.cpp /I 
d:/SRA_plus_VV_new/openslide-win64-20120908/include/openslide  
d:\..\openslide-win64-20120908\lib\libopenslide.lib
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:DRMTest.exe
DRMTest.obj
d:\...\openslide-win64-20120908\lib\libopenslide.lib

D:\...\openslide-win64-20120908\DRMTest\DRMTest\DRMTest>DRMTest.exe 
D:\...\44598.svs
Prog started

At this point I get a crash message ...




More information about the openslide-users mailing list