Files
mercury/samples/c_interface/mercury_calls_cplusplus/cpp_main.cc
Fergus Henderson 2bda4471e2 Fix a bug where the Mercury calls C++ sample was not linking with the
Estimated hours taken: 0.25
Branches: main

Fix a bug where the Mercury calls C++ sample was not linking with the
C++ library.  This worked, because the sample didn't actually make use
of the C++ library, but failed as soon as users tried to extend the
sample to use with their real C++ programs.

samples/c_interface/mercury_calls_cplusplus/cpp_main.cc:
	Use the C++ standard library's stream I/O, rather than printf().

samples/c_interface/mercury_calls_cplusplus/Mmakefile:
	Make sure that we link with the C++ standard library.
	Also, comment out the old hack that worked around a g++ 2.7 bug
	which is fixed in g++ 2.95.
2003-10-09 03:09:53 +00:00

15 lines
264 B
C++

// This source file is hereby placed in the public domain. -fjh (the author).
#include <iostream>
#include "cpp_main.h"
// Use some C++ features
class Foo { };
void cpp_main(void) {
Foo *p = new Foo;
std::cout << "In cpp_main()." << std::endl;
delete p;
}