Slice build failure on Windows

nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.

Currently we are migrating our application to Windows platform but our slice files could not be built successfully.

The issue could be reproduced in the following steps:

  1. Use project wizard to create a win32 project targeting for a static lib without precompiled header
  2. Add Ice Builder as instructed
  3. Add 2 slice files as follows:
/* RPC.ice */
 #pragma once
 
 [["java:package:com.ytzb.ytb.slice"]]
module RPC {

enum Result {
    // general status starting from 0
    Success = 0,
    
};

};
/* MarketModel.ice */
#pragma once

[["java:package:com.ytzb.ytb.slice"]]
module MarketModel
{
};
  1. Build project

The error output:

Error   1   error C2039: 'Int64' : is not a member of 'IceUtil' D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\Config.h 84  1   Test
Error   2   error C2146: syntax error : missing ';' before identifier 'Long'    D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\Config.h 84  1   Test
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\Config.h 84  1   Test
Error   4   error C2039: 'Shared' : is not a member of 'IceUtil'    D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    21  1   Test
Error   5   error C2143: syntax error : missing ';' before '*'  D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    21  1   Test
Error   6   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    21  1   Test
Error   7   error C2039: 'Shared' : is not a member of 'IceUtil'    D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    25  1   Test
Error   8   error C2143: syntax error : missing ';' before '*'  D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    25  1   Test
Error   9   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamF.h    25  1   Test
Error   10  error C2039: 'Shared' : is not a member of 'IceUtil'    D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\LocalObjectF.h   21  1   Test
Error   11  error C2143: syntax error : missing ';' before '*'  D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\LocalObjectF.h   21  1   Test
Error   12  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\LocalObjectF.h   21  1   Test
Error   13  error C2039: 'Shared' : is not a member of 'IceUtil'    D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\LocalObject.h    27  1   Test
Error   14  error C2516: 'Ice::Shared' : is not a legal base class  D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\LocalObject.h    27  1   Test
Error   15  error C2923: 'Ice::StreamableTraits' : 'Ice::Long' is not a valid template type argument for parameter 'T'  D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  185 1   Test
Error   16  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  189 1   Test
Error   17  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  197 1   Test
Error   18  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  205 1   Test
Error   19  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  213 1   Test
Error   20  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  221 1   Test
Error   21  error C2913: explicit specialization; 'Ice::StreamableTraits' is not a specialization of a class template   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  233 1   Test
Error   22  error C2976: 'Ice::StreamableTraits' : too few template arguments   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  242 1   Test
Error   23  error C2976: 'Ice::StreamableTraits' : too few template arguments   D:\Program Files (x86)\ZeroC\Ice-3.6.3\include\Ice\StreamHelpers.h  250 1   Test
Error   24  error C1189: #error :  Ice version mismatch!    D:\projects\Test\Test\generated\rpc.h   36  1   Test

The platform is win7 64bit and VS2013. Ice version is 3.6.3 installed from standard windows msi distribution downloaded from official website. The active configuration is WIN32 and the result is the same for x64.

Would you please help advise how to fix the issue? Please let me know if you need more detaills.

Thanks
Daniel

Best Answer

  • nailding1nailding1 Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.
    Accepted Answer

    Hi, Bernard,

    I finally figured out the issue was caused by the incorrect macro setting. That is, when project is created with wizard for a static lib, it will define WIN32 by default. But it seems ICE needs WIN32_LEAN_AND_MEAN macro such that some MFC libraries will NOT be included to eliminate the possible confliction (say, MFC RPC library in my case).

    I am not sure where there is corresponding description in the document to address the issue and I would suggest pointing this out in the documentation if otherwise.

    Thanks
    Danel

Answers

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    Hi Daniel,

    The last error suggests a version mismatch, meaning you (accidentally) generated rpc.h and rpc.cpp using a version of slice2cpp other than 3.6.3. This could explain all the other errors. Can you open projects\Test\Test\generated\rpc.h and see which version it shows?

    Then:
    - clean your project (in particular remove rpc.h and rpc.cpp)
    - check and fix your Ice home directory in TOOLS > Options > Projects and Solutions > Ice Builder; the correct value is C:\Program Files (x86)\ZeroC\Ice-3.6.3
    - rebuild

    Cheers,
    Bernard

  • nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.

    Hi Bernard,

    Thanks for your quick response. The following is the except from RPC.h:

    // **********************************************************************
    //
    // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
    //
    // This copy of Ice is licensed to you under the terms described in the
    // ICE_LICENSE file included in this distribution.
    //
    // **********************************************************************
    //
    // Ice version 3.6.3
    //
    // 
    //
    // Generated from file `RPC.ice'
    //
    // Warning: do not edit this file.
    //
    // 
    //
    ...
    

    I installed Ice-3.6.3 to D:\Program Files (x86)\ZeroC\Ice-3.6.3 and my Ice Home Directory has been set to that value already on a double check.

    I packed my solution in the attachment and would you have a look ?

    One thing need to mention is: I ever built Ice-3.6.3 & 3.7a3 on the same machine from source code successfully and installed the build of Ice-3.6.3 to d:\Ice-3.6.3 as instructed in README.md for windows. I ever build my project with that version but got the same errors, which is why I turned to official msi install. Would that impact the behavior of msi installation of Ice-3.6.3? In my opinion, if the installation just copy files, there should be no impact.

    Thanks
    Daniel

  • nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.

    The slice files locate under another directory and were added to Slice Files manually, which are exactly the same as posted in the first post. Please save both to corresponding files and add both to project.

  • nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.

    Hi, Bernard,

    Just an update: I tried to install vs2013 64bit version and Ice-3.6.3 (32bit) on a fresh win7 (64bit) system but got the same errors. I followed the same steps as in my first post. Any special configuration I need to set to make successfully?

    Thanks
    Daniel

  • nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.

    Hi, Bernard,

    Just an update: I tried to install vs2013 64bit version and Ice-3.6.3 (32bit) on a fresh win7 (64bit) system but got the same errors. I followed the same steps as in my first post. Any special configuration I need to set to make successfully?

    Thanks
    Daniel

  • nailding1nailding1 Member Daniel DingOrganization: Beijing Yintong Zhibo Technology Co.Ltd..Project: A multi-terminal application including iOS/Android/PC/Mac so far) which provide financial equity and derivative trading system as well as supporting information service.
    Accepted Answer

    Hi, Bernard,

    I finally figured out the issue was caused by the incorrect macro setting. That is, when project is created with wizard for a static lib, it will define WIN32 by default. But it seems ICE needs WIN32_LEAN_AND_MEAN macro such that some MFC libraries will NOT be included to eliminate the possible confliction (say, MFC RPC library in my case).

    I am not sure where there is corresponding description in the document to address the issue and I would suggest pointing this out in the documentation if otherwise.

    Thanks
    Danel

Sign In or Register to comment.