Boost logo

Boost Users :

Subject: Re: [Boost-users] [function] Boost.Function won't compile under Borland DevStudio 2006
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-04-13 13:46:40


2010/4/13 Fábio 'Petrucio' Stange <petrucio_at_[hidden]>:
> Ok, here's simpler code that demonstrates the same problem:
>
>
> #include <boost/function.hpp>
> #include <iostream.h>
>
> void FooBar(boost::function0<void> callback) {
>  callback();
> }
>
> void CallbackImpl() {
>  cout << "Called back ok\n";
> }
>
> int main(int argc, char* argv[])
> {
>  FooBar(CallbackImpl);
>  return 0;
> }
>
>
> I'm stuck with Builder because we already have a major system built with it
> (don't look at me, it was coded by Mechanical and Automation Engeneers, I
> was hired later to deal with it, so you can guess the size of my problem). I
> plan on porting it to Visual Studio, but finding the time and resources to
> do that is probably years away. And I probably won't be here by then.

Well trying to compile that example verbatim results in:

  main.cpp(2) : fatal error C1083: Cannot open include file:
'iostream.h': No such file or directory

Fixing that to be iostream and not iostream.h results in:

  main.cpp(9) : error C2065: 'cout' : undeclared identifier

Fixing that to be qualified as it should be results in:

  main.cpp(12) : warning C4100: 'argv' : unreferenced formal parameter
  main.cpp(12) : warning C4100: 'argc' : unreferenced formal parameter

But it otherwise works and runs just fine. Based on the error you
posted in your first post, that is perfectly valid code, not sure what
could be upsetting it, and not sure how it could be fixed without
slowing down the code (which would be fine if you do not mind that),
but there might still be further issues, especially if this compiler
has issues with something as simple as boost::function. I do not see
how this could easily be worked around, that compiler is unsupported
by just about everything in existence due to how non-compliant it has
always been (it even makes VC6 look intelligent by comparison), but
perhaps just a plain function pointer would work fine if you do not
need the enhanced capabilities of boost::function?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net