Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error in exemple 6 #230

Open
pcouderc12 opened this issue Oct 17, 2019 · 4 comments
Open

compile error in exemple 6 #230

pcouderc12 opened this issue Oct 17, 2019 · 4 comments

Comments

@pcouderc12
Copy link

(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 create(shared_ptr serv, const int connectionId) = 0;
^~~~~~

@andriusign
Copy link

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] ^~~~~~

@ADoncel
Copy link

ADoncel commented May 7, 2020

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.

@andriusign
Copy link

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?

@vincent-richard
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants