Static in Qt c++ Embedded Python


 
Thread Tools Search this Thread
Top Forums Programming Static in Qt c++ Embedded Python
# 1  
Old 10-10-2010
Static in Qt c++ Embedded Python

i have a problem in Use static variables in Qt C++ under CentOS 5.5
i need to pass a variable from GUI to class all function are static.
it always give me that error error: undefined reference to strChar
Code:
class QPython : public QObject
{
private:
public:
QString strChar;

static PuObject* AddFile(PyObject* pSelf, PyObject* pArgs)
{
QList<QString> str;
str.append(strChar);
}
};

also i try this code it has also the same error
Code:
class QPython : public QObject
{
private:
public:
static QString strChar;

static PuObject* AddFile(PyObject* pSelf, PyObject* pArgs)
{
QList<QString> str;
str.append(strChar);
}
};

# 2  
Old 10-10-2010
The second code is correct - you need to declare strChar to be static if you want to call it from static functions without creating instances of the object.

However, all this does is declare strChar - it does not define it. To do that, you need to stick something like:

Code:
QPython::strChar;

In some source file.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies

2. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

3. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

4. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

5. UNIX for Dummies Questions & Answers

Embedded systems

Hi, I dont know whether it is the right space to put it... but didnt found related Embedded. I want to start learning Embedded systems in Unix, It would be greatly appreciable if someone could help me to start off .... Thanks (0 Replies)
Discussion started by: Deei
0 Replies

6. Linux

Could static library include static library?

I have some static library(libxxx.a libyyy.a). And I want to generate my library(libzzz.a), libzzz.a will use libxxx.a and libyyy.a I wan't my application only use libzzz.a, (means libzzz.a had include libxxx.a, libyyy.a), how can I do that? Thank you. example: I have zzz.c. I do ... (4 Replies)
Discussion started by: freemagic
4 Replies

7. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

8. Shell Programming and Scripting

Embedded list? Is this possible

I need to write a script that maintains many directories. I was wondering is there is a way to create a list of the directories inside a script so that you can then use “while read line” to perform different commands for each directory. Something like this #!/bin/sh MYLIST: /dir1 /dir2... (1 Reply)
Discussion started by: zasxes
1 Replies
Login or Register to Ask a Question