*
at***********@gmail.com:
g++ wont let me compile boost signals, not even the example that comes
in the documentation. I have the libboost_signals.a binary but im not
sure if im using it correctly. Here is the code
#include "boost/signal.hpp"
#include <iostream>
I'd prefer to put the Boost libraries in the default library search path
for the compiler, and writing
#include <boost/signal.hpp>
int main() {
struct HelloWorld
{
void operator()() const {
std::cout << "Hello, World!" << std::endl;
}
};
Class HelloWorld probably needs to be declared outside 'main'. Reason:
you can't instantiate a template on a local class, and most likely this
class will be used that way.
boost::signal<void()sig;
Note that the documentation lists an alternate form for
not-very-up-to-date compilers; however, a recent version of g++ should
be OK.
HelloWorld hello;
sig.connect(hello());
Probably this should be
sig.connect( hello );
sig();
return 0;#include "boost/signal.hpp"
Uh...
}
g++ complains about the expression void being used in an invalid way.
I dont know what i am doing wrong
The fixes above may not be enough. Just to make sure I plugged the code
into Visual Studio, but it complains about not finding the library. And
I just don't feel like delving into those tool issues right now, sorry.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?