vmime
vmime copied to clipboard
compile error in exemple 6
(note I have renamed exampl6.cpp inmain.cpp)
../main.cpp:315:72: required from here
/usr/include/c++/8/ext/new_allocator.h:136:4: error: invalid new-expression of abstract class type ‘myTracerFactory’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../main.cpp:34:
../example6_tracer.hpp:39:7: note: because the following virtual functions are pure within ‘myTracerFactory’:
class myTracerFactory : public vmime::net::tracerFactory {
^~~~~~~~~~~~~~~
In file included from /usr/include/vmime/net/socket.hpp:37,
from /usr/include/vmime/platform.hpp:34,
from /usr/include/vmime/vmime.hpp:34,
from ../main.cpp:31:
/usr/include/vmime/net/tracer.hpp:99:30: note: ‘virtual std::shared_ptrvmime::net::tracer vmime::net::tracerFactory::create(std::shared_ptrvmime::net::service, int)’
virtual shared_ptr
Any updates on this issue?
Got these errors:
[build] /usr/include/c++/7/ext/new_allocator.h:136:4: error: invalid new-expression of abstract class type ‘myTracerFactory’ [build] { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } [build] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] /usr/include/vmime/net/tracer.hpp:99:30: note: virtual std::shared_ptr<vmime::net::tracer> vmime::net::tracerFactory::create(std::shared_ptr<vmime::net::service>, int) [build] virtual shared_ptr <tracer> create(shared_ptr <service> serv, const int connectionId) = 0; [build] ^~~~~~
In the method:
vmime::shared_ptr <vmime::net::tracer> create(
vmime::shared_ptr <vmime::net::service>& serv,
const int connectionId
) {
return vmime::make_shared <myTracer>(stream, serv->getProtocolName(), connectionId);
}
You need to change:
vmime::shared_ptr <vmime::net::service>& serv,
to:
vmime::shared_ptr <vmime::net::service> serv,
As you could notice checking the abstract class.
I have changed the code as you suggested but this caused even more errors now. Is there a working example of this VMIME send email with authentication?
The correct prototype for the method is:
shared_ptr <tracer> create(const shared_ptr <vmime::net::service>& serv, const int connectionId);
Be sure to use the latest VMime code from the Git repository. Method takes a const shared_ptr<>&
argument, not a shared_ptr<>&
nor a shared_ptr<>
. This has changed on August 2018.