diff --git a/examples/dump_torrent.cpp b/examples/dump_torrent.cpp index 4a0ac4cce..d41909490 100644 --- a/examples/dump_torrent.cpp +++ b/examples/dump_torrent.cpp @@ -53,8 +53,10 @@ int main(int argc, char* argv[]) boost::filesystem::path::default_name_check(boost::filesystem::no_check); #endif +#ifndef BOOST_NO_EXCEPTIONS try { +#endif std::ifstream in(argv[1], std::ios_base::binary); in.unsetf(std::ios_base::skipws); entry e = bdecode(std::istream_iterator(in), std::istream_iterator()); @@ -98,11 +100,13 @@ int main(int argc, char* argv[]) << last << " ]\n"; } +#ifndef BOOST_NO_EXCEPTIONS } catch (std::exception& e) { std::cout << e.what() << "\n"; } +#endif return 0; } diff --git a/examples/make_torrent.cpp b/examples/make_torrent.cpp index 72d9f2e62..5b1563aa1 100644 --- a/examples/make_torrent.cpp +++ b/examples/make_torrent.cpp @@ -85,8 +85,10 @@ int main(int argc, char* argv[]) return 1; } +#ifndef BOOST_NO_EXCEPTIONS try { +#endif boost::intrusive_ptr t(new torrent_info); path full_path = complete(path(argv[3])); ofstream out(complete(path(argv[1])), std::ios_base::binary); @@ -121,11 +123,13 @@ int main(int argc, char* argv[]) // create the torrent and print it to out entry e = t->create_torrent(); libtorrent::bencode(std::ostream_iterator(out), e); +#ifndef BOOST_NO_EXCEPTIONS } catch (std::exception& e) { std::cerr << e.what() << "\n"; } +#endif return 0; } diff --git a/examples/simple_client.cpp b/examples/simple_client.cpp index fb4dfc0a0..51d1eab22 100644 --- a/examples/simple_client.cpp +++ b/examples/simple_client.cpp @@ -35,9 +35,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include -#include - #include "libtorrent/entry.hpp" #include "libtorrent/bencode.hpp" #include "libtorrent/session.hpp" @@ -57,7 +54,9 @@ int main(int argc, char* argv[]) return 1; } +#ifndef BOOST_NO_EXCEPTIONS try +#endif { session s; s.listen_on(std::make_pair(6881, 6889)); @@ -72,9 +71,12 @@ int main(int argc, char* argv[]) std::cin.unsetf(std::ios_base::skipws); std::cin >> a; } +#ifndef BOOST_NO_EXCEPTIONS catch (std::exception& e) { std::cout << e.what() << "\n"; } +#endif return 0; } +