Archived

This forum has been archived. Please start a new discussion on GitHub.

Some strange errors from MSVC.net

I am very interested in using Ice, but I am having some problems when I tried to put some test Ice code into one of my applications, and I cant track down the problem.. perhaps one of you could help me out a bit...

Here are the errors MSVC.net gives me when I try to compile:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2059: syntax error : ':'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2059: syntax error : ':'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: syntax error : missing '{' before ':'

It goes on like that to give me about 100 errors, all on the same syntax in both cstdio and cstdlib.


Im sure it is something simple I am over looking, but I cant find it... any help would be appreciated.

Comments

  • Oh yes,

    And the code I am using is from the Hello demo, the demo compiles fine, but when I use some of the code in a seperate app it causes these errors.
  • From the error messages, it doesn't seem to be related to Ice, since it's an error an a header file supplied by Visual C++ .NET. Perhaps you have a typo in your code before a #include statement? This sometimes causes such problems.
  • What Im confused about is that the file, without the Ice code, compiles fine. The demo compiles fine. But when I put the demo code into the other app then it doesnt work. I included Ice/Ice.h and Hello.h and set the libs to Ice.lib and IceUtil.lib... Is there something I am overlooking?
  • Here is the Ice coe I am using:

    #include <Ice/Ice.h>
    #include "Hello.h"

    using namespace std;

    and the function:

    void cg_IceTest()
    {
    Ice::PropertiesPtr properties = communicator->getProperties();
    const char* proxyProperty = "Hello.Proxy";
    string proxy = properties->getProperty(proxyProperty);
    if(proxy.empty())
    {
    cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl;
    return EXIT_FAILURE;
    }

    Ice::ObjectPrx base = communicator->stringToProxy(proxy);
    HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false));
    if(!twoway)
    {
    cerr << argv[0] << ": invalid proxy" << endl;
    return EXIT_FAILURE;
    }
    HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway());
    HelloPrx batchOneway = HelloPrx::uncheckedCast(twoway->ice_batchOneway());
    HelloPrx datagram = HelloPrx::uncheckedCast(twoway->ice_datagram());
    HelloPrx batchDatagram = HelloPrx::uncheckedCast(twoway->ice_batchDatagram());

    bool secure = false;
    int timeout = -1;

    twoway->sayHello();

    catch(const Ice::Exception& ex)
    {
    cerr << ex << endl;
    }

    return EXIT_SUCCESS;
    }






    If I comment out the function and the includes then I get this error:

    cg_buttons.c(10) : error C2061: syntax error : identifier 'namespace'
    cg_buttons.c(10) : error C2059: syntax error : ';'

    And I have established that the error is from the includes, because just commenting out the function and the namespace definition gives me the same errors.
  • Sorry about the bump....

    But it is a bit important that I get this answered soon.
  • I'm sorry, but I'm afraid I have no clue what the problem could be.
  • bernard
    bernard Jupiter, FL
    A way to figure out such problem is to save the precompiled version of your translation unit into a file, and then look at it ... or post it here.

    Cheers,
    Bernard