473,788 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does this error means "cannot call member function 'X' without object "

Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance

May 17 '07 #1
2 22765
mahesh wrote:
Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance
Yes, try http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

However, the error is fairly clear. You are trying to call a member
function X. You must have an object to call X on, e.g.

either

T obj;
obj.X();

or

T *obj = new T;
obj->X();

Since I doubt that you are making a T::X() call directly in your code, I
suspect you have a static member function in T, and are trying to call
X() from within it. Won't work. A static member function doesn't have
a this pointer, so you still need a pointer to, a reference to, or an
actual T object to call X() on.

May 17 '07 #2
mahesh wrote:
Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance
The place in your code where you attempt to call a class member function
without an instance of the class?

--
Ian Collins.
May 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
28035
by: André Somers | last post by:
Hi, I'm having a problem that I have a hard time understanding. I am getting a "Fatal error: Call to a member function on a non-object" on a constructor of a class, that looks like this (simplified): class phpBB_Template { var $classname = "Template"; // Root template directory.
2
2380
by: inonzuk | last post by:
why strange you ask? here goes: I have been working with Php and Mysql for a week without any problems. Today I tried executing a php page that connects to mysql and creates a new database, I got this error: "Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\test\_debug_tmp.php on line 3". I did some reading on the net and checked all my configuration, and it
1
3964
by: Fie Fie Niles | last post by:
I have IIS installed on XP Professional workstation machine. I have an ASP page that open connection to an Access database, then when trying to update the database, it gave me the error "cannot update database or object is read-only". This is a workstation machine, not connected to any other computer, and I login to the PC using an administrator account. I already check the .MDB file is NOT read-only. But, I do not see the .LDB file....
5
2782
by: awdsites | last post by:
Hi, I'm a noob with a server so keep that in mind :) Been trying to connect with php to mysql and all I get is: "Fatal error: Call to undefined function: mysql_connect()" I've read and read and can't figure out what is wrong. My current set up is:
10
2889
by: Thorsten Ottosen | last post by:
Hi, I'm trying to escape html before its saved in a database. I tried $text = htmlentities( $reader->value ); but that don't work for e.g. japanese characters.
5
16504
by: loudwinston | last post by:
Hello, I'm encountering a strange error with PDO. The server is FreeBSD 4.4, PHP 5.1.2, mySQL 4.0.20 with 4.1.18 client libs. I have the following code (usernames and passwords changed to protected the innocent ^_^) <? $db_dsn = "mysql:host=dbHost;dbname=dbName";
1
1885
by: prajataayu123 | last post by:
Can anyone please guide me as to how to fix the below mentioned problem from php ... Fatal error: Call to a member function on a non-object in /usr/local/apache2/htdocs/knowledgeTree-OSS/lib/browse/DocumentCollection.inc.php on line 414 ///////////////// The code is as follows...
2
4087
by: ironmanlarry | last post by:
Hi, I'm trying to do a mail merge from Excel to Word (programatically) and I'm having some trouble creating the Word Document Object. This line of code wordDoc = GetObject("sheet.doc") keeps returning the error "cannot create ActiveX component" and then the program crashes. Any help is much appreciated. Thank you. Larry
4
2536
by: dougans | last post by:
Hey there, Hope someone can help me, completely stuck with immigrating from php4 to OOP based php5. == index.php -- include(database.inc.php);
0
1631
by: msconfused | last post by:
Hello all. I'm hoping that someone can help me solve this error. This is the error that I am getting. Fatal error: Call to a member function on a non-object in /home/paytoo/public_html/prices.php on line 2 Below is the complete contents of the file. <? $sql=$Db1->query("SELECT COUNT(userid) AS total FROM user WHERE refered=''"); $referralcount=$Db1->fetch_array($sql);
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.