• Advertisement

Archived

This topic is now archived and is closed to further replies.

what do i wrong

This topic is 5153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

error got: Referment at an object not imposted on a object instance i use a pointer at a class file1.h private: myClass *Bye; .... Some_function(){ myOther myForm = new myOther(); myOther->setPointer( Bye; ); } file myOther.h private: myClass *Bye2; public: void setPointer(myClass *Bye2temp){ Bye2 = Bye2temp; } public: myClass getPointer(){ return Bye2; } public: void AnotherFunction(){ this->getPointer()->itsFunction(); // ERROR }

Share this post


Link to post
Share on other sites
Advertisement
Sorry but why must i include that file?
What does it mean?

must i allocate memory or what?




[edited by - Link on January 14, 2004 12:14:11 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi
quote:
Original post by Link
What does it mean?
Read this.

Might I also suggest learning the language before trying to use it, or people here will tire rapidly of you. That, or at least post in the For Beginners forum.


that source is a good one, but please let's read what is posted before to talk!
Are you sure that these pages are pertinent with my question?
Are you sure i've really need to learn the language?
Now think.



[edited by - Link on January 14, 2004 12:59:42 PM]

Share this post


Link to post
Share on other sites
You don''t know how #include works. In other posts you didn''t know how #define worked.

Yes, you really need to learn how to use the language.

Share this post


Link to post
Share on other sites
Yes, that page seems to be pertinent to your question. Yes, your grasp of the language is such that trying to figure out what you''re actually trying to say can be rather irritating.

The code you posted, however, is so incredibly bad that it makes it even more difficult to see what''s going on. Hint: Posting "example" code is usually a bad idea. Instead, post the actual code, the bits of it that are relevant.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
No offence but: If you ask where the BIOS password is, you should learn much about how a computer works, left alone how to program...



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
It is so pathetic your attendance to defend a moderator.
Anyway #define is so different from #include, understanding include is necessary to start to program in c++, instead #define is a thing that could be flyed over at the first time.
All my C++ books hold on #define mush little so there all my doubts.
The Bios is an anspect much little handled, so if you know all about it i''m sorry if you are not the future Bill Gates!

in that code in myOther.h i declare none File1 object so i don''t need to include file1.h at all.

Now, i repeat, think!

Share this post


Link to post
Share on other sites
You may know how to write an #include statement, but you don''t know how one works. That''s obvious from your other posts.

And knowing how a #define works is an integral part of programming Windows applications. The toy programs done in most C++ programming books happen to live in a clean environment not cluttered by a decade or so of backwards compatible C code.

Quite frankly, the code fragment you gave is broken in so many different places it''s hard to isolate the flaw. The most likely cause is a missing include. It could be because you''re trying to use a value as a pointer. I have no clue, because that code is in nowhere near a compilable state.

Have you given any thought to trying to find a programming site with other Italians? I''m assuming that you''re using a localized version of MSVC .NET and that you''re attempting to translate the error codes that you get into English. Someone who actually can see the same errors as you do might be more suitable to helping you.

At the very least try giving the error numbers.

Share this post


Link to post
Share on other sites
Dude where did you find that compiler. The error message it spits out doesn''t even make sense in english.

Maybe you can try getting a new compiler first. Or learn how to copy and paste properly.

Share this post


Link to post
Share on other sites
I don''t know what language the error message you gave us is written in, but I know for sure I can''t understand it. And since you didn''t post the error number (like C2001 for instance), I simply don''t know what your error is, and thinking won''t help me about it.

The code you gave us does NOT compile, but I assume that''s why you are asking here for solutions. I''ll tell you why this code does not work :

file1.h :
- "private" : label found outside of class definition
- "myClass" : undefined token
- "myOther" : undefined token
- "setpointer( Bye;" : missing ) before ;

myOther.h
- "private" : label found outside of class definition
- "public" : label fount outside of class definition (x3)
- "myClass" : undefined token
- "this" : token undefined, defined only in member functions
- "getPointer()" : not a member of "this"
- "itsFunction()" : undefined token

Now 3 remarks about this.
1°) these are the only errors a normal human brain can make out for certain from the code you posted.
2°) of course, I can only assume that this is not the real code, and that the real code has the class declarations and everything correct, with only that line having an error. But you did not provide that code, and I''m not going to guess it.
3°) People that scour these forums have only limited time to spend on other''s problems. In your case, they had a little time to spend on answering your question. But they had to spend that time understanding the question, which leaves no time for the answers. Besides, the time they are willing to give you depends on whether they like you or not. We are not here to help you like we were slaves. If you talk down to us, treat us like idiots and make no effort to help us answer you, we have absolutely NO reason to help you. On Gamedev, people help each other out of friendship, not out of obligation.

Now, think about that.

Share this post


Link to post
Share on other sites
1)I haven''t given you a clean code, but jut an example to understand.
I don''t want you compile thatcode just understand the significate.
2)that error appear in the JIT debug not in the VS debug, ok i don''t understand the english, do u understand the italian?:

Le informazioni su come richiamare il debug JIT (Just-In-Time) anziché questa finestra
sono riportate in fondo al messaggio.

************** Testo dell''eccezione **************
System.NullReferenceException: Riferimento a un oggetto non impostato su un''istanza di oggetto.

Share this post


Link to post
Share on other sites
quote:
Original post by ToohrVyk
3°) People that scour these forums have only limited time to spend on other''s problems. In your case, they had a little time to spend on answering your question. But they had to spend that time understanding the question, which leaves no time for the answers. Besides, the time they are willing to give you depends on whether they like you or not. We are not here to help you like we were slaves. If you talk down to us, treat us like idiots and make no effort to help us answer you, we have absolutely NO reason to help you. On Gamedev, people help each other out of friendship, not out of obligation.


Show me where i treat you like idiots!
Now read all the treand and look where you''ve treated me as like.

Share this post


Link to post
Share on other sites
1.) You get an runtime error, not a link error, am I right?
2.) You ara using manged C++?

Do I get it so far? More information from the beginning on makes helping a lot easier.

And you have to learn a lot!

[edited by - VolkerG on January 14, 2004 3:17:05 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Link
1)I haven't given you a clean code, but jut an example to understand.
I don't want you compile thatcode just understand the significate.

The fact that you have an error shows quite clearly that you don't know the right way to do something. So how, exactly, are you so certain that that's the significant part? POST THE DAMN CODE.


"Sneftel is correct, if rather vulgar." --Flarelocke

[edited by - sneftel on January 14, 2004 3:18:45 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Link
2)that error appear in the JIT debug not in the VS debug, ok i don''t understand the english, do u understand the italian?:

Le informazioni su come richiamare il debug JIT (Just-In-Time) anziché questa finestra
sono riportate in fondo al messaggio.

************** Testo dell''eccezione **************
System.NullReferenceException: Riferimento a un oggetto non impostato su un''istanza di oggetto.


As a matter of fact, I found the Italian error message conveyed far more information than what you posted originally. And it looks like pointer has a null value when creating the second object. i.e.: the problem is most likely not in the code you showed us.

Share this post


Link to post
Share on other sites
Wow, who knew that NullPointerException was the same word in italian as in english?


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
quote:
Original post by Sneftel
Wow, who knew that NullPointerException was the same word in italian as in english?

*ahem* NullReferenceException.

Share this post


Link to post
Share on other sites
//file1.h

namespace MyNS
{
...
private: projectValues* Value;

function(){
Value->set_Width(220); // error
}

...
}


//projectValues.h
#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Diagnostics;


namespace MyNS
{
///
/// Summary for projectValues
///

__gc public class projectValues : public System::ComponentModel::Component
{
int width;

public:
projectValues(void)
{
InitializeComponent();
}
projectValues(System::ComponentModel::IContainer *container) : components(0)
{
///
/// Required for Windows.Forms Class Composition Designer support
///


container->Add(this);
InitializeComponent();
}

protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}

private:
///
/// Required designer variable.
///

System::ComponentModel::Container *components;

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

void InitializeComponent(void)
{
components = new System::ComponentModel::Container();
}


public:
void set_Width(int value){ width = value; }
int get_Width(){ return width; }


};
}

[edited by - Link on January 14, 2004 3:43:34 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by SiCrane
quote:
Original post by Sneftel
Wow, who knew that NullPointerException was the same word in italian as in english?

*ahem* NullReferenceException.

Can you tell I''ve been spending too much time with Java?


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
Link, the error means that, at the point where Value->set_Width() is called, Value has not been assigned a non-NULL value. The important part is not the projectValues class, but the code that should allegedly be initializing Value. What code does that?


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
quote:
Original post by Link
i can''t understand, sorry.


He means where is the code that says ''Value = something''?

Share this post


Link to post
Share on other sites

This topic is 5153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.

  • Advertisement