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.
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?
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.
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++.
- 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.