C2259 Cannot Instantiate

Hello,
I am a beginner with C++. I ran into the error C2259 cannont instantiate class. I have check with the other reports on here of this error, but did not understand the answers. The important thing here is that I am not working with my own code. I am using software code from a company to compile a mathematical model. Most of the answers here suggested changes within the code, but I am fairly certain that the code should be correct and I am expecting the error to be involved with the way I set up the code somehow.
thanks

The class is probably abstract and you are not supposed to create instances (i.e. objects) of it. Maybe there is another class that inherit from the abstract class that you can instantiate. Or perhaps you are supposed to create your own class that inherit from the abstract class.
http://www.cplusplus.com/doc/tutorial/polymorphism/ has section about Abstract base classes.

https://en.wikibooks.org/wiki/C%2B%2B_Programming/Classes/Abstract_Classes

Keywords:
Inheritance, virtual methods, polymorphism. Interface and implementation.
I wanted to point out, I did not make any changes to the code, and the code is supplied from a company. I presume the code is correct because I do not see instances on their tutorials forums from other people having this problem. Is there anyway of creating this problem through choices made in the Visual Studio compiler?
It looks like you need to talk to the company that supplied the code.
I did, they told me to come here :(
Can you show us your code?
If they told you to come here then they must want us to see the code (to fix it for them, perhaps :-) ). You need to provide a zip file of it.
Last edited on
For the record, I first had a problem with the code C1083, can not open precompiled header. This was strange, as I had included all the files necessary, but it was telling me it couldn't find some of them. I solved this problem by looking it up as online, but I forget how. How do you attach files? I tried to include a snapshot of the relevant code and error message, I am not sure if I am allowed to send out the files or not.
You can't attach files here so you need to host them somewhere - maybe dropbox - and post the link here. What compiler / IDE do you use ?
I am using Visual Studio 2015. Here is a picture of the error and the code from which it originates.
https://www.dropbox.com/s/jux7shz2c8iytg5/Visual%20studio%20error.PNG?dl=0
You have two files with almost identical names. Is that a mistake?
tbp wrote:
It looks like you need to talk to the company that supplied the code.
bplumier wrote:
I did, they told me to come here :(

You are supposed to build your program using some library/engine/framework.
That library expects you to inherit from its interfaces.
The library is commercial. Its vendor did direct you here?

I see two scenarios:

1. Commercial product does not have proper documentation. The vendor expects the paying clients to figure everything out.

2. The product has proper documentation, but it expects the user to understand basics of C++. The vendor does not teach C++.


I don't find these scenarios equally probable.


Are the "their tutorials forums" open to public?
> I ran into the error C2259 cannont instantiate class
http://www.cplusplus.com/forum/articles/40071/#msg216270
- Don't tell us you're getting error C2203. We don't know what that is.
- Don't paraphrase/reword the error. Chances are you're leaving out/changing some critical information that we need.
you didn't say that the class was abstract
you don't show where you are trying to instantiate it

> I am expecting the error to be involved with the way I set up the code somehow.
>> Is there anyway of creating this problem through choices made in the Visual Studio compiler?
¿wouldn't be easier if you told us what you did?

> I am not sure if I am allowed to send out the files or not.
you've got several options:
- assume that you can't
- take the risk
- ask

> Here is a picture of the error
¡great, now can test my ocr!
Your picture shows part of a file
CHertzMindlin.cpp
The error is stated to come from a different file,
HertzMindlin.cpp

So go to the correct file (the latter of the two above) and see where it is incorrectly trying to create an object of the offending class. In fact, if you would show us what is in that file somewhere around line 8 that would be great.

The contents of the separate header file CHertzMindlin.h, which probably shows the public interface, would also be useful.

I take it the software is related to this:
https://www.edemsimulation.com/academia/
in which case, that software supplier does have its own forum.
Last edited on
Topic archived. No new replies allowed.