Programming :: Object To Represent An Object Of Different Types?

Mar 1, 2010

Only ones I can think of seem overly complex, and I'm sure there is a simple solution I am overlooking. I have a class, it has a member who is an object. This object needs to be able to represent an object of different types.

[code]...

Where "surface" could be several different types, which will be set during execution. Hope this is clear enough. I have tried using templates but am getting "data member cannot be a member template". Either I have incorrect syntax, or am not implementing it right. another solution would have one class containing definitions of all possible shapes, But this would take up extra memory. Other solutions I thought of seem too round-about, and seems there is a simpler solution that I have overlooked.

View 8 Replies


ADVERTISEMENT

Ubuntu Multimedia :: Error - Object Reference Not Sent To An Instance Of An Object

Mar 6, 2010

I've been using the PPA version of banshee, and I got this error - just wondering if anyone else has it too! I'm able to play a song, but when the song finishes and the next one starts I get this error: Banshee Encountered a Fatal Error Object reference not sent to an instance of an object Error details:

Code:
An unhandled exception was thrown: Object reference not set to an instance of an object
at Hyena.Gui.Theming.GtkTheme.GetCairoTextMidColor (Gtk.Widget) <0x00017>
at Banshee.NotificationArea.NotificationAreaService.get_TextLightColor () <0x0002f>
at Banshee.NotificationArea.NotificationAreaService.MarkupFormat (string,string[]) <0x00043>
at Banshee.NotificationArea.NotificationAreaService.GetByFrom (string,string,string,string) <0x000d7>

[Code]....

View 4 Replies View Related

Programming :: Different Processes Using Same File Object

Sep 29, 2009

I have 2 completely different processes A and B (they do not have any relationship) suppose A opens a file with file descriptor 4 and B opens another file with file descriptor 5

Can process A use the fd 5 (i.e using the file object of processs B) by any means..if suppose i let the fd 4 of process A to point to the file object of process B(fd 5) will it work? is it safe?

View 3 Replies View Related

Programming :: How To View An Object File

Aug 14, 2009

Is there any way may be some tools to view and explore contents of .obj files (in a formatted or unformatted way) or an executable. Can we do it using gcc?

View 1 Replies View Related

Programming :: Groovy Scripting - An Object-oriented Programming Language For The Java Platform ?

Mar 7, 2010

Groovy is an object-oriented programming language for the Java platform. I do not have experience in Java, only perl and shell scripts. Recently I have been asked to maintain a software written in groovy (also to make enhancements). So can I learn groovy without knowing java language. or isit I have to learn java before venturing into groovy.

View 1 Replies View Related

Programming :: Python: 'Instancemethod' Object Is Unsubscriptable?

Jan 18, 2011

im having some trouble printing a buffered item in python. My code is as follows:

Code: Class buffer:
def __init__(self, max):
self.data = [0 for i in range(max)]

[code]....

View 2 Replies View Related

Programming :: Cmake - Unable To Add Object To Static Lib

Nov 3, 2010

I'm creating a static lib via cmake,and when I view the .a binary file with less/more/cat I see functions from my time_tools.c, but not my other_api.c The directories structure is:

Code:

CMakeLists.txt
time/CMakeLists.txt
time/time_tools.c
time/time_tools.h

[code]....

View 2 Replies View Related

Programming :: Passing An Object To A Running Thread?

Jan 14, 2011

This is a client server issue where the server creates a new thread for listening to a new client, now when the thread starts execution and during its execution the server needs to pass it an object of some X class, how's that to be done?

View 4 Replies View Related

Programming :: Saving Serializable Object Within It's Own Class

May 12, 2011

I found out how to save an object using Serializable in JAVA, the standard however how can I set up my MainVariableList to have a function/method saveobject so it saves the object within it's own class, the below code compiles, however when I run it reports an error on startup but works, basically what do I use for the red line, how do I tell it what object is passed to the class?

View 1 Replies View Related

Programming :: Code - Blocks - Shared Object - Debugger ?

Jan 18, 2010

I have created an application that has a executable program that loads in a shared object

the shared object loads in another shared object

both of these shared object I have created

For debugging I have been printf'in data to determine what is going on

I now have some odd memory issue, and need a bit more control over debugging...

I have one workspace set up and under my exectuable(will call maintest from now on) I have two items in my link libraries under project build options being soA and soB (so A is the shared object that maintest uses, soB is the SO that soA uses) I also have linker options pthread and ldl

At the beginning of my maintest I do my dlsym and load in each function that I will be using

I always run my program using maintest, because when I have one of the SO as the startup project(turns bold) and try to run it gives me "You must select a host application to run a library"

I tried to set up this host library, i Go to Menu->Project->SetProgramArguments and change the Host Application to the debug version of my maintest

I then hit OK and try to run again but I get the same error: "You must select a host application to run a library"

If I get this part working - which I need help doing, is tehre other steps that need to be taken to debug the so's? or will this make it so when i hit f8 it will run.

View 1 Replies View Related

Programming :: Compile Shared Object Files Using Valac ?

Oct 20, 2010

What flags do you have to pass to valac to compile code into a shared library (file extension .so)?

View 1 Replies View Related

Programming :: How Can An Object File Be Executed Without Startup And Housekeeping

Sep 22, 2009

I came from Windows and I am want to learn how C++ programs are compiled and executed in Linux. I read in "Thinking in C++" that the linker adds (by default) a startup module to the object files that an application should be made of. Now when I use g++, I can create an single object module out of a single source code file then execute it in the terminal like this:

./objectFile.out

How can this object file be executed while it doesn't contain the startup module? In Windows, object files usually get combined into an executable file (somthing.exe) then that executable can be executed, is this not necessary in Linux? does the OS perform required actions before it executes that object file?

View 3 Replies View Related

Programming :: Paint Pixels In C / C++ Without Going In To Object Oriented Prog?

Aug 24, 2009

I want to findout how to paint a line in C without using a line function or OOP. I want to control it by pixels.

View 6 Replies View Related

Programming :: Produce COFF Format Object File Using GCC Or AS?

May 10, 2010

I am trying to have GNU assembler produce object file COFF format? I did not find relevant information from GNU assembler's manual.

View 1 Replies View Related

Programming :: Iterating Through All Listed Keys In An IPC::Cache Object?

Jul 27, 2011

I need to find a way to iterate through all listed keys in an IPC::Cache object. There doesn't seem to be an example of this I can find.

View 1 Replies View Related

Programming :: Pass By Reference A Parameter Without Assigning A New Object?

Dec 28, 2010

How can I pass by reference, a parameter, without assigning a new object? In my first example, var = "changed" creates a new local object. In the second, mylist.append will affect the reference target. How to i achieve the same effect with example 1?

Code:
#!/bin/python
var = "unchanged"
def print_string( var ):

[Code].....

View 2 Replies View Related

Programming :: Error With Compiling Program 'can Not Be Used When Making Shared Object'

Oct 14, 2010

I've got an error with compiling a program: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/python2.5/config/libpython2.5.a: could not read symbols: Bad value collect2: ld a retourn 1 code dtat d'excution make[2]: *** [bindings/_yafqt.so] Erreur 1.

View 1 Replies View Related

Programming :: Changing Shared Object File Default Place

Mar 27, 2010

I wanted to know how can I change the default place of shared object files of a program in a system. let me explain it better for you : I have an embedded computer with Linux OS that its file system is read only and I can not add any file to /usr /lib and ..... and I can just mount a SD memory card to it and copy all of my programs to it and run them from there as you understand I have two choices to choose, first make one big binary file for each program that I am doing it now and it is not a suitable solution and the second is finding the way to change default place of shared object file of my program.

View 1 Replies View Related

Programming :: Execute A Function Which Is In A Object File Throgh Libbfd?

Sep 10, 2010

I hava a source file add.c

int add(int a,int b){
return a+b;
}

then i compile it, gcc -c add.c now we get a object file add.o, I want to execute the function add(int a,int b)(the functinon in the object file add.o) how can i use libbfd to execute it?

View 1 Replies View Related

Programming :: Java - Object Oriented - How It Works - Set The Getter And Setter ?

Feb 28, 2011

I have a peace of code the does not work:

View 1 Replies View Related

Debian Programming :: How To Find Total Size Of A List Object In Byte

Jan 11, 2013

Assuming there are two list objects a1, a2.

a1 = ['
']
a2 =['hi
']

len() built-in function gives total number of elements in the list object.
len(a1) gives 1. len(a2) gives 1 also.

Code: Select all$ python
Python 2.7.3 (default, SepĀ  9 2012, 17:41:34)
[GCC 4.7.1] on linux2

[Code]......

I thought there exists a built-in function that gives total size of a list object in byte. So using the function produces 1 for a1, 3 for a2. I haven't found such function or module yet.

View 3 Replies View Related

Programming :: Assigning Structure Object's Variable Outside Main() Gives Parse Error

Sep 2, 2010

Kindly take a look at the code below :

Code:
#include <stdio.h>
struct test
{
int i;
int j;

[Code]....

why i am getting this error. I know the error is occuring because i have assigned values to obj.i and obj.j outside main(). But i want to know why do that result in an error. From my part i have created an object 'obj' of stucture 'test' and assigned values to its variables.

View 7 Replies View Related

Programming :: Build An Object Code For ARM At91rm9200 Board From A Makefile Using A Crosscompiler?

Apr 17, 2011

I want to build an object code for ARM at91rm9200 board from a Makefile using a crosscompiler.

View 4 Replies View Related

Programming :: Python Regular Expression - AttributeError: 'NoneType' Object Has No Attribute 'group'

Aug 23, 2010

I am trying to scan a website for http references (links) with this script:

Code:

from urllib import urlopen
import re
current_site = urlopen("http://en.wikipedia.org/wiki/").read()
search = re.search('href="[a-zA-Z0-9]"', current_site)

[code]....

I get the following error message:

Code: Traceback (most recent call last): File "C:UsersadminDesktopcrawler.py", line 8, in <mo print search.group(0) AttributeError: 'NoneType' object has no attribute 'group' I have googled the error

View 2 Replies View Related

Programming :: Linking Object Files With Geany On Ubuntu - Undefined Reference To Class::functionName

Mar 9, 2009

I have created a simple test class - Mortgage, with the class declaration in the .h file and the class's methods defined in the .cpp file. (mortgage.h && mortgage.cpp, respectively) Straight up C++ 101 as far as I can tell. I instantiate the class in the main() function, which is defined in practice.cpp. Using Geany on Ubuntu, both the practice.o and mortgage.o files are created, but then I get a linker error: undefined reference to class::functionName

I get it for each function. If the mortgage.cpp file is foremost in the editor when I click "build", then I get the undefined reference to main() error, if practice.cpp is foremost (where the main() function is) then I get undefined reference to Mortgage::Mortgage(), and all the rest of the functions defined for that class. How do I get the linker to know where my object files are so it will link them in? Or is the problem somewhere else entirely?

View 8 Replies View Related

Programming :: Save / Load Data Segment Of Dynamically Loaded Shared Object Library?

Aug 25, 2010

Our application uses a dynamically loaded shared object library (codec library) to compress and decompress audio streams.

There happens to be several static and global variables in this shared object library. Hence it is not possible to process two interleaved unrelated media streams using this shared object codec library because each stream corrupts/changes the contents of these static/global variables.

Is there a way through which a context save (save contents of data segment of shared object) and a context load (load previously saved contents of data segment of shared object)operation can be performed on the shared object library. This way the context for each media stream can be saved and loaded before and after processing the "other" media stream respectively.

View 3 Replies View Related

Programming :: Can't Call Method "prepare" Without A Package Or Object Reference?

Oct 4, 2010

I have the following code in the TCP server:Quote:

while (my $from_who = accept(CLIENT_SOCK, TCP_SOCK)) {
my $data = '';
#my $previous = select CLIENT_SOCK;

[code]...

View 5 Replies View Related

Programming :: Libmpi_f90.so.0: Cannot Open Shared Object File: No Such File Or Directory

Aug 6, 2010

I am running after compiling a program and I find that I get the following. How best can I avoid this as i cannot run the program. I have tried removing the offending package, although I cannot find it. I have also tried re-installing. I have also tried changing FC and F90 flags to avoid the MPI version.

error while loading shared libraries: libmpi_f90.so.0: cannot open shared object file: No such file or directory

View 1 Replies View Related

Programming :: "Unresolved Reference" Error While Doing Dynamic Linking Of C++ (shared Object)

Apr 13, 2011

I am creating two shared libs that i intend to be dynamically linkable in C and C++, cross platform Linux/Windows/Mac. As a basic sketch, true for both libs, the lib code is in several .c/.cpp and .h files. For now, I'll talk about the part that I am actively working on, a lib named Discover, i.e. libdiscover.so.1.0. First, everything is in a namespace, RemKon_Discover.

The main Discover.cpp defines the methods for the Discover class (declared in Discover.h) and has extern "C' routines that can return pointers to my main c++ object. The call to GetLibraryMainPointer() creates a Discover class object, theMainObject (ok, I win a prize for dumb names) and returns the (non-mangled) pointer to the caller over in my test program. The Discover class itself is declared extern "c" and the tester program #includes "Discover.h".

In the test program, dlopen() correctly opens the lib and dlsym() gets the pointer to theMainObject. However, when I use that pointer in the tester program to access a method (aDiscoverObject->hello(), e.g.) I get compile time errors saying that Discover::hello() in an undefined reference. My makefile is attached.

[Code]....

View 10 Replies View Related

Programming :: "Cannot Open Shared Object File"?

May 13, 2010

Now that I've entered the realms of permanent beta software I'm completely lost.

I compile a program like this: icc main.c -L. -lxyz -L/usr/X11R6/lib -lX11 -lpthread -lm -std=c99

(But I have no concrete idea about what -L and -l mean. l is short for lib? Why? -L seems to specify the path for some library that follow directly afterwards?). Anyway, it works.

So I get an output file a.out (why a?), which I run by writing ./a.out .

Then I get this error message: error while loading shared libraries: lxyz.so: cannot open shared object file: No such file or directory

I have it in my directory but it won't find it? What's wrong?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved