Error cannot call member function without object

This program has the user input name/age pairs and then outputs them, using a class. Here is the code. #include "std_lib_facilities.h" class Name_pairs { public: bool test(); void

This program has the user input name/age pairs and then outputs them, using a class.
Here is the code.

#include "std_lib_facilities.h"

class Name_pairs
{
public:
       bool test();
       void read_names();
       void read_ages();
       void print();
private:
        vector<string>names;
        vector<double>ages;
        string name;
        double age;
};

void Name_pairs::read_names()
{
     cout << "Enter name: ";
     cin >> name;
     names.push_back(name);
     cout << endl;
}

void Name_pairs::read_ages()
{
     cout << "Enter corresponding age: ";
     cin >> age;
     ages.push_back(age);
     cout << endl;
}

void Name_pairs::print()
{
     for(int i = 0; i < names.size() && i < ages.size(); ++i)
             cout << names[i] << " , " << ages[i] << endl;
}

bool Name_pairs::test()
{
   int i = 0;
   if(ages[i] == 0 || names[i] == "0") return false;
   else{
        ++i;
        return true;}
}


int main()
{
    cout << "Enter names and ages. Use 0 to cancel.n";
    while(Name_pairs::test())
    {
     Name_pairs::read_names();
     Name_pairs::read_ages();
     }
     Name_pairs::print();
     keep_window_open();
}

However, in int main() when I’m trying to call the functions I get "cannot call 'whatever name is' function without object." I’m guessing this is because it’s looking for something like variable.test or variable.read_names. How should I go about fixing this?

Ziezi's user avatar

Ziezi

6,3273 gold badges37 silver badges47 bronze badges

asked Jul 14, 2009 at 20:15

trikker's user avatar

3

You need to instantiate an object in order to call its member functions. The member functions need an object to operate on; they can’t just be used on their own. The main() function could, for example, look like this:

int main()
{
   Name_pairs np;
   cout << "Enter names and ages. Use 0 to cancel.n";
   while(np.test())
   {
      np.read_names();
      np.read_ages();
   }
   np.print();
   keep_window_open();
}

Jason Plank's user avatar

Jason Plank

2,3424 gold badges32 silver badges40 bronze badges

answered Jul 14, 2009 at 20:19

sth's user avatar

sthsth

218k53 gold badges277 silver badges364 bronze badges

0

If you want to call them like that, you should declare them static.

answered Jul 14, 2009 at 20:20

Rob K's user avatar

Rob KRob K

8,6292 gold badges32 silver badges35 bronze badges

2

just add static keyword at the starting of the function return type..
and then you can access the member function of the class without object:)
for ex:

static void Name_pairs::read_names()
{
   cout << "Enter name: ";
   cin >> name;
   names.push_back(name);
   cout << endl;
}

answered Jun 4, 2019 at 9:57

Ketan Vishwakarma's user avatar

You are right — you declared a new use defined type (Name_pairs) and you need variable of that type to use it.

The code should go like this:

Name_pairs np;
np.read_names()

O'Neil's user avatar

O’Neil

3,7904 gold badges15 silver badges30 bronze badges

answered Jul 14, 2009 at 20:21

dimba's user avatar

dimbadimba

26.3k30 gold badges138 silver badges195 bronze badges

  1. Fix the error: cannot call member function without object in C++
  2. Use an Instance of the Class to Access the Member Functions
  3. Use Static Member Functions

Error: Cannot Call Member Function Without Object in C++

This article describes the commonly occurring error cannot call member function without object while doing object-oriented programming using C++. Furthermore, it also provides potential fixes to the error.

Fix the error: cannot call member function without object in C++

A common error in C++ frequently occurs when working in object-oriented programming, stating cannot call member function without object. The cause of this error is that you are calling some member method of the class without instantiating the class.

Every class has a set of data members and some member functions. We need to create the class object to access the member methods or functions and then call/access the methods using this object.

Consider the following code.

#include<iostream>
using namespace std;
class Rectangle{
    private:
        int length=5;
        int width=8;
    public:
    double getArea()
    {
        return length*width;

    }
};
int main()
{
    cout<<"Area: "<<Rectangle::getArea()<<endl;
}

This code will generate the following output.

cannot call member function without object

Line #16 in the above code snippet tries to call the getArea() method using the class name. All the non-static members of a class must only be accessed through an object of the class; therefore, the line generates the error.

Use an Instance of the Class to Access the Member Functions

The error can be solved by calling the function/method with an object of the class like this:

int main()
{
    Rectangle r;
    cout<<"Area: "<<r.getArea()<<endl;
 }

This will give the correct output.

Use Static Member Functions

Static member functions are the functions of a class that do not need an object to call them. They can be called directly with the class name using the scope resolution operator ::.

Certain limitations must be kept in mind when using the static member functions. A static member function can access only the static data members of the class and can only call the other static member functions.

Let’s look at the example below discussing the solution to the cannot call member function without object error.

#include <iostream>

using namespace std;

class Rectangle{
    private:
        int length =5;
        int width=8;
    public:
    double getArea()
    {
        return length*width;
    }
    static void getShapeName()
    {
        cout<<"Hello, I am a Rectangle."<<endl;
    }

};
int main()
{

    Rectangle r ;
    cout<<"Area: "<<r.getArea()<<endl;
    Rectangle::getShapeName();
 }

This will give the following output.

Area: 40
Hello, I am a Rectangle.
  • Forum
  • Beginners
  • Cannot call member function without obje

Cannot call member function without object

Hi, I’m having problem calling a function from a class in the main.cpp. Could someone tell me how to fix this please?

1
2
3
4
5
6
7
8
9
10
11
12
//main.cpp

#include <iostream>
#include <fstream>
#include <string>
#include "CD.h"

using namespace std;
class CD;

double mind, maxd;
CD dwindow = CD::setd(mind, maxd);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//CD.h

#ifndef CD_H_
#define CD_H_

#include <string>
#include <vector>

using namespace std;

class CD {
public:
	virtual ~CD();
	CD(Data, double, double);

	/// Virtual copy constructor.
	virtual CD* clone() const = 0;

	void setd(double mind, double maxd);
};
#endif 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//CD.cpp

#include "iostream"
#include "CD.h"

using namespace std;

//method: set min and max d's
void CD::setd(double mind, double maxd) {
	_mind = mind;
	_maxd = maxd;
}
CD::~CD() {
}

If I set the method to be static, then I get the following error: «cannot declare member function ‘static void CD::setd(double, double)’ to have static linkage».
Thank you in advance for your help!

A class represents a «thing», but the class itself is not actually a thing. You need to create objects of that class. Each object is its own thing.

For example… string is a class. This means that you can have multiple «objects» of type string. Each has its own string data.

1
2
string foo = "hi";
string bar = "there";

Here, foo and bar are both strings. Now you can call member functions (such as the length function) by using the object name and the dot operator:

 
size_t len = foo.length();  // get the length of the foo string 

But without an object, a call to length makes no sense:

1
2
3
4
size_t len = string::length();  // ??  what string are we getting the length of?
  //  is it foo?  is it bar?  is it something else?
  // doesn't make any sense!
  //  so the compiler will give this line an error. 

This is basically what you’re doing. You’re trying to call setd, but you’re not telling the compiler which CD object you want to set. So it spits that error at you.

You’ll need to create an object:

1
2
3
CD myCD;

myCD.setd( ... );

Last edited on

where do I create that object?

Objects are just like normal variables (like ints, doubles, etc). Declare it wherever you need to use it.

Topic archived. No new replies allowed.

Mesteriis

599 / 237 / 69

Регистрация: 08.08.2015

Сообщений: 1,637

1

20.01.2017, 22:07. Показов 10700. Ответов 3

Метки нет (Все метки)


Доброе время суток ребят такая фигня, решил значит наконец то классы освоить но прям беда! чой то не пойму

h файл

C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef MCT_H
#define MCT_H
#include <string>
 
class MCT
{
private:
 
    static std::string FirstString;
    static std::string SeacondString;
 
public:
 
    MCT();
 
    void PrintFS ();
    void PrintSS ();
    bool AddFS(std::string InputString);
    bool AddSS(std::string InputString);
};
 
#endif // MCT_H

реализация класса

C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "mct.h"
 
MCT::MCT()
{
 
}
 
 
MCT::PrintFS ()
{
    if (FirstString.size()==0) std::cout << "FirstString is NULLn";
    std::cout<< FirstString << std::endl;
}
 
MCT::PrintSS ()
{
    if (FirstString.size()==0) std::cout << "FirstString is NULLn";
    std::cout<< FirstString << std::endl;
}
 
MCT::AddFS(std::string InputString)
{
    FirstString=InputString;
//    if (FirstString==InputString) return false;
    return true;
}
 
MCT::AddSS(std::string InputString)
{
    SeacondString=InputString;
//    if (SeacondString==InputString) return false;
    return true;
}

ну и маин файл

C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
 
#include "mct.h"
 
using namespace std;
 
int main()
{
    new MCT;
 
    MCT::AddFS("test 1");
    MCT::AddSS("test 2");
 
    MCT::PrintFS();
    MCT::PrintSS();
 
 
    return 0;
}

и собственно ошибка

Bash
1
2
3
C:UsersAlexanderDocumentsjson_stringmain.cpp:21: ошибка: cannot call member function 'bool MCT::AddFS(std::string)' without object
     MCT::AddFS("test 1");
                        ^



0



GbaLog-

Любитель чаепитий

3734 / 1793 / 563

Регистрация: 24.08.2014

Сообщений: 5,998

Записей в блоге: 1

20.01.2017, 22:28

2

Лучший ответ Сообщение было отмечено Mesteriis как решение

Решение

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
 
#include "mct.h"
 
using namespace std;
 
int main()
{
    MCT* mct = new MCT;
 
    mct->AddFS("test 1");
    mct->AddSS("test 2");
 
    mct->PrintFS();
    mct->PrintSS();
 
 
    return 0;
}



1



599 / 237 / 69

Регистрация: 08.08.2015

Сообщений: 1,637

20.01.2017, 22:32

 [ТС]

3

GbaLog-, А можешь в двух словах объяснить?



0



Любитель чаепитий

3734 / 1793 / 563

Регистрация: 24.08.2014

Сообщений: 5,998

Записей в блоге: 1

20.01.2017, 22:39

4

Цитата
Сообщение от Mesteriis
Посмотреть сообщение

А можешь в двух словах объяснить?

Если метод класса не статический, то для обращения к ним нужен экземпляр этого класса.



0



Автор Тема: ошибка: cannot call member function without object  (Прочитано 6550 раз)
megido

Гость


значит есть у меня вот такая функция

шапка:
static void CALLBACK ProcessBuffer(const void *buffer, DWORD length, void *user);
код:
void  Player::ProcessBuffer(const void *buffer,DWORD length,void *user)
{
    emit SetSongName(time_info);

}
vold Player::Play()
{
    chan = BASS_StreamCreateURL(url,0,BASS_STREAM_BLOCK|BASS_STREAM_STATUS|BASS_STREAM_AUTOFREE,ProcessBuffer,this);

 }

когда я пытаюсь в ней послать сигнал получаю вот эту ошибку

ошибка: cannot call member function ‘void Player::SetSongName(QString)’ without object
     emit SetSongName(time_info);

кстати вызвать из нее другую функцию я тоже не могу

какой объект оно хочет?

« Последнее редактирование: Июнь 19, 2016, 02:12 от megido »
Записан
Bepec

Гость


Без кода можем только анекдот рассказать, за денежку.


Записан
Racheengel

Джедай : наставник для всех
*******
Offline Offline

Сообщений: 2679

Я работал с дискетам 5.25 :(

Просмотр профиля


а SetSongName помечена как Q_SIGNAL?


Записан

What is the 11 in the C++11? It’s the number of feet they glued to C++ trying to obtain a better octopus.

COVID не волк, в лес не уйдёт

kambala


из статического метода сигнал ты не пошлешь, так как это метод на уровне класса, не конкретного объекта.

тебе надо в качестве дополнительного параметра этому коллбэку передавать this (параметр user, насколько я понимаю), потом в коллбэке кастануть user к классу Player и вызвать метод (его надо написать), который внутри и пошлет сигнал.

« Последнее редактирование: Июнь 19, 2016, 02:29 от kambala »
Записан

Изучением C++ вымощена дорога в Qt.

UTF-8 has been around since 1993 and Unicode 2.0 since 1996; if you have created any 8-bit character content since 1996 in anything other than UTF-8, then I hate you. © Matt Gallagher

megido

Гость


а SetSongName помечена как Q_SIGNAL?

а как же


Записан
megido

Гость


из статического метода сигнал ты не пошлешь, так как это метод на уровне класса, не конкретного объекта.

тебе надо в качестве дополнительного параметра этому коллбэку передавать this (параметр user, насколько я понимаю), потом в коллбэке кастануть user к классу Player и вызвать метод (его надо написать), который внутри и пошлет сигнал.

спасибо за наводку. работает

    Player* pthis = (Player*)user;
    pthis->SetTimeInfo(time_info);


Записан

Python version:

Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0] :: Anaconda, Inc. on linux

GCC version:

 mariyan@mz-lin:~/dev/spconv$ gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

This is the error I am getting, any help would be appreciated! (essentially there are several errors that all say cannot call member function without object.)

tf) mariyan@mz-lin:~/dev/spconv$ python setup.py  bdist_wheel
running bdist_wheel
running build
running build_py
running build_ext
Release
|||||CMAKE ARGS||||| ['-DCMAKE_PREFIX_PATH=/home/mariyan/.conda/envs/tf/lib/python3.7/site-packages/torch', '-DPYBIND11_PYTHON_VERSION=3.7', '-DSPCONV_BuildTests=OFF', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr"', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/mariyan/dev/spconv/build/lib.linux-x86_64-3.7/spconv', '-DCMAKE_BUILD_TYPE=Release']
-- Caffe2: CUDA detected: 10.1.105
-- Caffe2: CUDA nvcc is: /usr/local/cuda-10.1/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-10.1
-- Caffe2: Header version is: 10.1
-- Found cuDNN: v7.5.0  (include: /usr/local/cuda-10.1/include, library: /usr/local/cuda-10.1/lib64/libcudnn.so)
-- Autodetected CUDA architecture(s): 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
-- pybind11 v2.3.dev0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mariyan/dev/spconv/build/temp.linux-x86_64-3.7
[  7%] Building CUDA object src/utils/CMakeFiles/spconv_nms.dir/nms.cu.o
[ 14%] Building CUDA object src/spconv/CMakeFiles/spconv.dir/indice.cu.o
[ 28%] Building CUDA object src/spconv/CMakeFiles/spconv.dir/maxpool.cu.o
[ 28%] Building CUDA object src/spconv/CMakeFiles/spconv.dir/reordering.cu.o
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6679:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
       __p->_M_set_sharable();
       ~~~~~~~~~^~
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6684:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’ without object
src/utils/CMakeFiles/spconv_nms.dir/build.make:62: recipe for target 'src/utils/CMakeFiles/spconv_nms.dir/nms.cu.o' failed
make[2]: *** [src/utils/CMakeFiles/spconv_nms.dir/nms.cu.o] Error 1
CMakeFiles/Makefile2:202: recipe for target 'src/utils/CMakeFiles/spconv_nms.dir/all' failed
make[1]: *** [src/utils/CMakeFiles/spconv_nms.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6679:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
       __p->_M_set_sharable();
       ~~~~~~~~~^~
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6684:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’ without object
src/spconv/CMakeFiles/spconv.dir/build.make:88: recipe for target 'src/spconv/CMakeFiles/spconv.dir/indice.cu.o' failed
make[2]: *** [src/spconv/CMakeFiles/spconv.dir/indice.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6679:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
       __p->_M_set_sharable();
       ~~~~~~~~~^~
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6684:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’ without object
src/spconv/CMakeFiles/spconv.dir/build.make:114: recipe for target 'src/spconv/CMakeFiles/spconv.dir/reordering.cu.o' failed
make[2]: *** [src/spconv/CMakeFiles/spconv.dir/reordering.cu.o] Error 1
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6679:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
       __p->_M_set_sharable();
       ~~~~~~~~~^~
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5033:20:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5054:24:   required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134:   required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6684:95:   required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’ without object
src/spconv/CMakeFiles/spconv.dir/build.make:140: recipe for target 'src/spconv/CMakeFiles/spconv.dir/maxpool.cu.o' failed
make[2]: *** [src/spconv/CMakeFiles/spconv.dir/maxpool.cu.o] Error 1
CMakeFiles/Makefile2:108: recipe for target 'src/spconv/CMakeFiles/spconv.dir/all' failed
make[1]: *** [src/spconv/CMakeFiles/spconv.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 89, in <module>
    zip_safe=False,
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
    self.run_command('build')
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 40, in run
    self.build_extension(ext)
  File "setup.py", line 73, in build_extension
    subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
  File "/home/mariyan/.conda/envs/tf/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j4']' returned non-zero exit status 2.

  1. 23rd October 2010, 04:07


    #1

    Default cannot call member function without object

    I get the following error when trying to connect two classes together:

    1. qapp.cpp: In static member function 'static bool QApp::eventFilter(void*)':

    2. qapp.cpp:32: error: cannot call member function 'void QApp::mouseCoord(int, int, int, int, int)' without object

    To copy to clipboard, switch view to plain text mode 

    main.cpp:

    1. int main(int argc, char *argv[])

    2. {

    3. QApp a(argc, argv);

    4. Widget w;

    5. w.show();

    6. QObject::connect(&a,SIGNAL(mouseCoords(int, int, int, int, int)),

    7. &w,SLOT(mouseCoords(int, int, int, int, int)));

    8. return a.exec();

    9. }

    To copy to clipboard, switch view to plain text mode 

    qapp.cpp:

    1. emit mouseCoord(get_raw_mouse_x_delta(i), get_raw_mouse_y_delta(i), // this is line 32...

    2. is_raw_mouse_button_pressed(i, 0), is_raw_mouse_button_pressed(i, 1), is_raw_mouse_button_pressed(i, 2));

    To copy to clipboard, switch view to plain text mode 

    I have searched the forum and found several issues quite like mine, but not enough to help me out.


  2. 23rd October 2010, 05:54


    #2

    Default Re: cannot call member function without object

    As the compiler error message says, you cannot call a member function, which requires a «this» pointer, from a static method that does not have a «this» pointer to give. This might do it:

    1. QApp *app = qobject_cast<QApp>(qApp);

    2. app->mouseCoords(...);

    To copy to clipboard, switch view to plain text mode 

    BTW: Is that mouseCoord() or mouseCoords() ? You aren’t consistent.


  3. 23rd October 2010, 13:01


    #3

    Default Re: cannot call member function without object

    If I do this:

    1. QApp *app = qobject_cast<QApp>(qApp);

    2. app->mouseCoords(...); // what is this exactly? Am I not supposed to use connect()?

    To copy to clipboard, switch view to plain text mode 

    Then what happens to this?

    1. QApp a(argc, argv);

    To copy to clipboard, switch view to plain text mode 

    Thanks for the help.


  4. 23rd October 2010, 13:23


    #4

    Default Re: cannot call member function without object

    I would ask first why did you make your QApp::eventFilter() method static?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. 23rd October 2010, 15:18


    #5

    Default Re: cannot call member function without object

    I made it static because that’s the only way it would work with QAbstractEventDispatcher(). I was experiencing some difficulties with setting QAbstractEventDispatcher() filter and a thread here in QtCentre Forum said that I should make eventFilter() static, I did and it worked. Only for that reason. But if there is a better way I would really like to know.

    EDIT:
    if I remove «static» from eventFilter I get this error message:

    1. qapp.cpp: In constructor 'QApp::QApp(int&, char**)':

    2. qapp.cpp:14: error: no matching function for call to 'QAbstractEventDispatcher::setEventFilter(<unresolved overloaded function type>)'

    3. c:Qt2010.05qtincludeQtCore/../../src/corelib/kernel/qabstracteventdispatcher.h:91: note: candidates are: bool (* QAbstractEventDispatcher::setEventFilter(bool (*)(void*)))(void*)

    To copy to clipboard, switch view to plain text mode 

    Last edited by been_1990; 23rd October 2010 at 15:30.


  6. 23rd October 2010, 15:30


    #6

    Default Re: cannot call member function without object

    But this method shouldn’t be static. And if you make it static then you can’t call non-static methods from it. What do you need QAbstractEventDispatcher for and what is that you can’t make work without making eventFilter() static?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. 23rd October 2010, 15:33


    #7

    Default Re: cannot call member function without object

    I need QAbstractEventDispatcher to be able to get WM_INPUT messages because winEvenFilter won’t do it.

    EDIT:
    if I remove «static» from eventFilter I get this error message:

    1. qapp.cpp: In constructor 'QApp::QApp(int&, char**)':

    2. qapp.cpp:14: error: no matching function for call to 'QAbstractEventDispatcher::setEventFilter(<unresolved overloaded function type>)'

    3. c:Qt2010.05qtincludeQtCore/../../src/corelib/kernel/qabstracteventdispatcher.h:91: note: candidates are: bool (* QAbstractEventDispatcher::setEventFilter(bool (*)(void*)))(void*)

    To copy to clipboard, switch view to plain text mode 


  8. 23rd October 2010, 15:52


    #8

    Default Re: cannot call member function without object

    Can we see the exact code?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. 23rd October 2010, 16:09


    #9

    Default Re: cannot call member function without object

    Yes. Here it is:
    main.cpp:

    1. #include <QtGui/QApplication>

    2. #include <QObject>

    3. #include "widget.h"

    4. #include "qapp.h"

    5. int main(int argc, char *argv[])

    6. {

    7. //QApp *app = qobject_cast<QApp>(qApp);

    8. QApp a(argc, argv);

    9. Widget w;

    10. w.show();

    11. QObject::connect(&a,SIGNAL(mouseCoord(int, int, int, int, int)),

    12. &w,SLOT(mouseCoord(int, int, int, int, int)));

    13. return a.exec();

    14. }

    To copy to clipboard, switch view to plain text mode 

    qapp.cpp:

    1. extern "C"{

    2. #include "raw_mouse.h"

    3. }

    4. #include "qapp.h"

    5. #include <QDebug>

    6. #include <QAbstractEventDispatcher>

    7. #define WM_INPUT 0x00FF

    8. QApp::QApp(int & argc, char ** argv) :

    9. {

    10. qDebug() << init_raw_mouse(1, 0, 1);

    11. qDebug() << raw_mouse_count();

    12. }

    13. bool QApp::eventFilter(void *msg)

    14. {

    15. MSG *mess;

    16. mess = (MSG*)msg;

    17. //qDebug() << mess->message;

    18. switch(mess->message){

    19. case WM_INPUT:

    20. {

    21. add_to_raw_mouse_x_and_y((HANDLE)mess->lParam);

    22. for (int i = 0; i < raw_mouse_count(); i++){

    23. emit mouseCoord(get_raw_mouse_x_delta(i), get_raw_mouse_y_delta(i),

    24. is_raw_mouse_button_pressed(i, 0), is_raw_mouse_button_pressed(i, 1), is_raw_mouse_button_pressed(i, 2));

    25. }

    26. }

    27. return true;

    28. }

    29. return false;

    30. }

    To copy to clipboard, switch view to plain text mode 

    app.h:

    1. #ifndef QAPP_H

    2. #define QAPP_H

    3. #include <QApplication>

    4. {

    5. Q_OBJECT

    6. public:

    7. explicit QApp(int & argc, char ** argv );

    8. //bool winEventFilter(MSG *message, long *result);

    9. static bool eventFilter(void *msg);

    10. private:

    11. signals:

    12. void mouseCoord(int x, int y, int btn1, int btn2, int btn3);

    13. public slots:

    14. };

    15. #endif // QAPP_H

    To copy to clipboard, switch view to plain text mode 


  10. 23rd October 2010, 17:01


    #10

    Default Re: cannot call member function without object

    Why not do it this way?

    1. bool myInputEventFilter(void*);

    2. Q_OBJECT

    3. friend bool myInputEventFilter(void *);

    4. public:

    5. QApp(int argc, char **argv) : QApplication(argc, argv){

    6. init_raw_mouse(1, 0, 1);

    7. }

    8. signals:

    9. void mouseCoord(int x, int y, int btn1, int btn2, int btn3);

    10. };

    11. // the following function may probably be made static so that it doesn't pollute the namespace

    12. bool myInputEventFilter(void *msg) {

    13. MSG *mess = (MSG*)msg;

    14. QApp *app = (QApp*)qApp;

    15. switch(mess->message){

    16. case WM_INPUT:

    17. {

    18. add_to_raw_mouse_x_and_y((HANDLE)mess->lParam);

    19. for (int i = 0; i < raw_mouse_count(); i++){

    20. emit app->mouseCoord(get_raw_mouse_x_delta(i), get_raw_mouse_y_delta(i),

    21. is_raw_mouse_button_pressed(i, 0), is_raw_mouse_button_pressed(i, 1), is_raw_mouse_button_pressed(i, 2));

    22. }

    23. }

    24. return true;

    25. }

    26. return false;

    27. }

    To copy to clipboard, switch view to plain text mode 

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. 23rd October 2010, 18:07


    #11

    Default Re: cannot call member function without object

    Great! Working perfectly now. Thanks Wysota.
    What do you mean with «pollute the namespace»?


  12. 23rd October 2010, 18:12


    #12

    Default Re: cannot call member function without object

    Quote Originally Posted by been_1990
    View Post

    What do you mean with «pollute the namespace»?

    Try defining (in a different cpp file) a function called myInputEventFilter and taking a void* as input and you’ll see for yourself.

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Понравилась статья? Поделить с друзьями:
  • Error cannot bind w authentication to computer null 000006d9 1753
  • Error cannot assign to a named constant at 1
  • Error cannot alter type of a column used by a view or rule
  • Error cannot allocate memory errno 12
  • Error cannot allocate kernel buffer