Microsoft Research Community

Using C API with Visual C++ 6 issue?

rated by 0 users
This post has 2 Replies | 2 Followers

Not Ranked
Posts 2
cosinepi Posted: 08-26-2009 10:15 AM

Hi all,

I just started with Z3 for a few days.

I have Visual Studio 6 Enterprise Edition on my lab machine, on a 32bit WinXP platform.

I downloaded Z3 2.1, installed, and am now trying to run the examples in the 'examples\c' directory. When I type 'build.cmd' in this directory, the following errors are given:

C:\Program Files\Microsoft Research\Z3-2.1\examples\c>cl /I ..\..\include ..\..\bin\z3.lib test_capi.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

test_capi.c
..\..\include\z3_api.h(2183) : error C2632: 'long' followed by 'long' is illegal
..\..\include\z3_api.h(2195) : error C2632: 'long' followed by 'long' is illegal
..\..\include\z3_api.h(2453) : error C2632: 'long' followed by 'long' is illegal
..\..\include\z3_api.h(2453) : error C2632: 'long' followed by 'long' is illegal
..\..\include\z3_api.h(2488) : error C2632: 'long' followed by 'long' is illegal
..\..\include\z3_api.h(2501) : error C2632: 'long' followed by 'long' is illegal

C:\Program Files\Microsoft Research\Z3-2.1\examples\c>

Similar error happens when I copy the files bin\z3.dll, bin\z3.lib, include\z3.h, and include\z3_api.h into my program folder and #include "z3.h".

I delved into the z3_api.h file and found that these lines are surrounded within the #ifndef CAMLIDL...#endif block. I then added the /D "CAMLIDL" switch to the build command that I use, then another syntax error at line 914 of z3_api.h arises. The surrounding lines there are

#ifndef CAMLIDL
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#else
[pointer_default(ref)] interface Z3 {                // line 914 of z3_api.h
#endif // CAMLIDL

The syntax error just reports a '['.

Is there any hint why this happens and how to fix it? Thank you in advance! (BTW, the .NET API examples are working fine. However for some reason I can only use C API's.)

--Vincent

 

 

Top 25 Contributor
Posts 41

Thanks for the report.


This is not a unique problem, for example:

http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=10836&view=next

You can probably work around the problem by replacing the strings "long long" by the suitable identifier for 64 bit numbers in the header file.
Thus, use __int64 as the message below indicates.

http://lists.trolltech.com/qt-interest/2004-03/msg00060.html

We have been using a newer version of Visual Studio to compile and test the samples and we did not try visual studio 6.0.
We will look into what we can do to make it compile under this version of visual studio as well (in other words find a compatible
replacement __int64 for long long in the header file for future releases).

The CAMIDL is a switch that should be defined only for the CAMIDL compiler, not the C++/C compilers.

Thanks,

 

Nikolaj

 

 

Not Ranked
Posts 2

Hi Nikolaj,

thank you for the fast reply! I've replaced all occurrences of 'long long' with '__int64' in z3_api.h, and now compilation works smoothly.Thank you very much!

Best wishes,

-- Vincent

Page 1 of 1 (3 items) | RSS
©2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Feedback