Programming :: POSIX__Philosophers At Dinner: Error: Initializer Element Is Not Constant

Jun 23, 2010

I changed my post because I found that solution, and didn't want to bother for that. But, since I didnt find a way to delete the post, I thought of updating it: I am beginning to write the code for the philosophers problem. As you know, they can eat, think or wait for forks. When they have 2 forks, one by each side, they eat. Then they set the 2 forks as available, and think.

Each philosopher is a thread. My problem is that it gives segmentation fault, somehow, when I try to initialize. The thing I really don't understand, is why it sometimes gives segmentation fault on initialization #0!!! (But generally on initialization #1) I have set 5 initializations in total, defined by N, that is also the number of threads I'm working on.

PHP Code: #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<errno.h>
#include <time.h>
#define N 5
[Code]....

View 1 Replies


ADVERTISEMENT

Programming :: [C++] Error: Array Must Be Initialized With A Brace-enclosed Initializer

Jun 29, 2011

I'm implementing exceptions using longjmp() (since C++ exceptions don't offer the features that I need, including resuming and a "finally" block), like this:

Code:

jmp_buf ex_jmpbuf;
void *ex_exception;
bool ex_resumable;
jmp_buf ex_resumebuf;

[code]....

Why are the curly braces being misinterpreted as arrays here, but not anywhere else?

View 11 Replies View Related

Programming :: Error - Array Type Has Incomplete Element Type

Jan 26, 2010

I'm trying to compile a program and it gives me the following:

I checked cmath-util.h:46 and cmath-util.h:48:

I'm not a C person, and the author is unavailable so far.

View 5 Replies View Related

Programming :: Variable `GPIO_LED_ctl_ops' Has Initializer But Incomplete Type?

Sep 16, 2010

when i compile the device driver of led ,i get the erro like this:

[root@localhost led]# arm-linux-gcc -D__KERNEL__ -DMODULE -I /home/liumeng/lmldd
/linux-2.6.34.1/ -c -O -Wall led.c -o led.o
led.c:34: error: variable `GPIO_LED_ctl_ops' has initializer but incomplete type

[code]....

View 1 Replies View Related

Programming :: Arrays In The C Programming Language Are Pointers To The First Element Of The Array?

Mar 27, 2010

I wonder why arrays in the C programming language are pointers to the first element of the array, not the first element of the array itself?

View 14 Replies View Related

Programming :: Select The 3rd Element Of A Drop Down List?

Feb 9, 2011

I'm trying to make a very small script with greasemonkey to do some automatic things when a page loads. The first thing I need to do is to click on a link. I've done that. Then I need to select the 3rd element of a drop down list that appears a few moments (depending on the connection) after the link is pressed, without reloading the page (ajax or something like that). This I can't get to work, The select has no id or class, but I can get its xpath value. There is only one select on the page. I've tried both setTimeOut and the DOMNodeInserted event with no effect.

Code:
// ==UserScript==
// @name test
// @namespace "www.google.com"
// @include www.mywebpage.com
// ==/UserScript==

[Code]....

View 11 Replies View Related

Programming :: Makefile Index Of List Element?

Apr 5, 2011

So I have been trying for 8 hours to try to get the index of an element from a list in a Makefile. The problem is that after I get the index using all the methods I have tried, the index cant be used in the "word" function:

for instance:
$(OUTPUT2) : INDEX = $(shell echo $(OUTPUT2) | sed -r -e "s/[ ]+/
/g" | grep -n $@ | sed 's/^([0-9]*):.*/1/')

will create a variable INDEX defined specifically for each member of OUTPUT2, so that each output knows its index. Unfortunately, when I pass this $(INDEX) into word, it doesn't work:

$(OUTPUT2) : $(word $(INDEX), $(INPUT1)) $(word $(INDEX), $(INPUT2))
echo $(INAME) $(TMPBASE) $@
and I get the error:
Makefile:16: *** non-numeric first argument to `word' function: 'num'. Stop.

I feel like if I could just convert a string to a Makefile acceptable number this would just work....

View 6 Replies View Related

Programming :: Count Occurrency Of Each Array Element - Perl?

May 10, 2010

Exist it a perl function to count how much each array element is into array?

View 14 Replies View Related

Programming :: Initialize Ksh Array When First Element Includes Hyphen?

Jul 19, 2011

I'm trying to create an array with variable including hyphenbut ksh refuses the first element

set -A allArgs
set +A allArgs ${allArgs[@]} -all
set +A allArgs ${allArgs[@]} -date

[code]...

View 5 Replies View Related

General :: Error: Expected Initializer Before "G_GNUC_NULL_TERMINATED"?

Apr 23, 2010

I am using Scientific Linux version 2.6.9-67.EL.cernsmp (root@lxcert-i386) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)) #1 SMP Wed Nov 21 16:22:33 CET 2007. Now I want to install rediff bol in it. so i downloaded rediff bol from the site

Code:
http://linux.softpedia.com/progDownload/rediffbol-prpl-Download-34762.html
after that i have downloaded libpurple and libpurple developement from

[code]....

View 2 Replies View Related

Ubuntu Installation :: Install 9.04 From Win7 By Wubi - Error "An Error Has Occurred Setting The Element Data"

Jan 26, 2010

I tried to install ubuntu 9.04 from wubi in windows 7 ultimate today. But it failed. I met a problem when installing: An error has occurred setting the element data. The request is not supported. The detailed information in installation log file is:

>>stdout=
01-26 13:29 DEBUG TaskList: # Cancelling tasklist
01-26 13:29 DEBUG TaskList: New task modify_bcd
01-26 13:29 ERROR root: Error executing command
>>command=C:WindowsSystem32cdedit.exe /set {d29666c7-0a4d-11df-a945-002268e2b352} device partition=I:
>>retval=1
>>stderr=An error has occurred setting the element data.

The request is not supported.

[Code].....

The request is not supported. I tried to use bcdedit /set <GUID> device partition=I: manually, but still have the same error.

View 2 Replies View Related

Programming :: Perl Beginner - Can't Get PerlMagick To Read Filename From Array Element?

Aug 21, 2010

it's been a while since I logged on here! I've been trying my hand at a little perl and have hit a brick wall.I'm using the Imagemagick module to manipulate some images. I can get the following to work without issue:

Code:
$teampath = "/var/www/team1";
$player=Image::Magick->new;

[code]...

View 1 Replies View Related

Programming :: Perl's Foreach Loop Can't Use An Array Element As The Control Variable?

Jul 22, 2011

I'm reading "OReilly Learning Perl 5th Edition", and there are such words:Code:You can use an array element like $fred[2] in every place? where you could use any other scalavariable like $fred.At the bottom of the page, it explains the ? like this:Code:The most notable exception is that the control variable of a foreach loop, which you?ll see later in this chapter, must be a simple scalar.Since Perl has the save-and-restore mechanism for the control variable, why an array element can't be used as the control variable

View 1 Replies View Related

Programming :: Libxml2: Removing Output On Stdout/stderr - Element CA Does Not Carry Attribute Maxlength

Jul 26, 2010

I'm using libxml2 to handle/manipulate some XML files. In order to check the consistency of a XML file, I have a DTD and I'm using the xmlValidateDtd method to compute the check.

However, when an error occures during the check (for example an attribute is missing in a XML tag), then libxml2 writes the error on the stdout/stderr. For exemple:

Code:

/home/XML/FreeFour.xml:18: element CA: validity error : Element CA does not carry attribute maxlength

The method return the right result (true or false depending on the check result), but occurring errors are written on the stdout/stderr, and I actually don't want that.

View 4 Replies View Related

Fedora :: ERROR: Exception Loading Options: No Element Found Line: 1 Column: 0

Jun 8, 2011

Code:

ali@localhost ~]$ k3d
ERROR: Exception loading options: no element found line: 1 column: 0
WARNING: Resetting options data to version 4
(k3d:12030): GdkGLExt-WARNING **: cannot load PangoFont
Segmentation fault (core dumped)

View 2 Replies View Related

Programming :: Can Predefine Constant Array In C?

Aug 1, 2010

Can I predefine constant array in c? with constants i do #define NAMEOFCONST value.is it possible to do this for an array? And if not I would like to know why. I suspect it has to do with memory handeling and pointers.

View 14 Replies View Related

Ubuntu :: Constant Error On DVD-DL Burn?

Sep 3, 2010

I'm on 10.04. 64bit (but dont think this is 64bit related)

I have been getting this very annoying error while trying to burn DVD-DL media from an iso using growisofs. Here is the command I used (to burn a backup copy of an xbox360 game)

Code:
growisofs -use-the-force-luke=dao -use-the-force-luke=break:1913760 -dvd-compat -speed=2.4 -Z /dev/scd0=nameofmyiso.iso
Now, every single time, usually around 50%, I get this error:

:-[ WRITE@LBA=aacf0h failed with SK=3h/WRITE ERROR]: Input/output error
write failed: Input/output error

I've been searching around and found threads with people complaining about this error since 2005, but not a single one of them presented any solution (some hint to a kernel issue, which I'd have no idea how to fix. I'm a noob at linux).

I also tried burning it using imgburn under wine, same error, also at 50%.

This is very frustrating, Ive burned around 6 coasters so far and DVD-DL are expensive to keep on this trial and error.

p.s It's not faulty media before anyone asks. I tried it on Mac and it worked fine. Also, this drive worked well before, before I migrated this machine.

View 1 Replies View Related

Debian :: SSH2 Constant Collide Error

Jul 19, 2015

Install SSH2, but he constantly collide error. It is that [pecl install -f ssh2] but unfortunately writes error and can not be installed. Now it is up to the SSH2 provides but unfortunately cancel running.

Here is the php info : [URL] .....

System : Debian 8.1 Jessie

Debian 7.8 : The installation fails without error but that is not enough fresh modules.

View 0 Replies View Related

Debian Configuration :: Constant Error When Running Apt-Get

Mar 9, 2010

Nothing serious (I think), but everytime I run apt-get to remove programs and doing upgrades... I get a strange message.

This is the output of apt-get upgrade:
Inspiron1525:/home/hernan# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
iamerican ibritish
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
17 not fully installed or removed.
After this operation, 4030kB disk space will be freed .....

And this is the output I get when removing a program (I removed amor so I can show the output):
Inspiron1525:/home/hernan# apt-get remove amor
Reading package lists... Done
Building dependency tree
Reading state information... Done

The following packages will be REMOVED:
amor iamerican ibritish
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
17 not fully installed or removed.
After this operation, 6185kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 89741 files and directories currently installed.)
Removing iamerican ...
/var/lib/dpkg/info/iamerican.postrm: line 6: /usr/sbin/remove-default-ispell: No such file or directory
dpkg: error processing iamerican (--remove):
subprocess post-removal script returned error exit status 1 .....
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I run update, I don't get the error though.

View 4 Replies View Related

Ubuntu :: Constant Error Message Regarding Kernel

Aug 11, 2011

I have installed Ubuntu 10.04 LTS on a flash drive and everytime I try to do an update I get the following error message:

Code:
Setting up linux-image-2.6.32-33-generic (2.6.32-33.72) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-33-generic
lzma: Encoder error: -2147467259
Failed to create initrd image.

[Code]...

also, I would like to know if I want to make clones of the flash drive, would a copy and paste suffice or do i need to use some cloning software? I have followed the instructions on ubuntu wiki to make my casper-rw larger than 4GB by making it an ext4 partition.

View 3 Replies View Related

Programming :: Warning: Deprecated Conversion From String Constant To Char*

Jul 3, 2010

I've just updated my linux system (Debian) and went to compile some code I'm working on. However it causes some problems, presumable because of GCC up dates. I get many of my subject line errors for example

../../common/Version_Control.cpp: In function int VersionControl():
../../common/Version_Control.cpp:55: warning: deprecated conversion from string constant to char*

So I check up the error and it comes from my error handler code which is a function

extern void SetError(char *string,int error_number)

The net tells me all I need to do is convert char *string to const char *string, however when I do so and recompile I get the following error

Error_Control.cpp: In function �void SetError(const char*, int)�:
Error_Control.cpp:41: error: invalid conversion from �const char*� to �char*�
make: *** [Error_Control.o] Error 1

I think I've done exactly what's recommended ?

View 3 Replies View Related

Programming :: G++ Warning - Deprecated Conversion From String Constant To 'char*'

Jan 10, 2011

My problem is that the warning keeps apperaing when I run g++ compilation.

Say, I have a system runtime function with header (imaginary)sysruntime.h: void printfunction(char *line);

Then in my .cpp file, I will include the above header #include <sysruntime.h>

Then, I do the below:
Line12: char *linetoprint = "Print this line";
Line13: printfunction(linetoprint);

But, I will get the warning message "Line12: deprecated conversion from string constant to 'char*'". (Even though it compiles)

My question is how should I declare my char* so that I wont get this warning message, and can still run printfunction(char* line) correctly?

View 7 Replies View Related

Ubuntu :: Computer No Longer Boots Constant Error

Dec 14, 2010

I have tried to keep away from posting this seeing how many have had the same problem but this is getting to the point of me just selling my computer out of shear frustration. Ive got Windows XP and Ubuntu 10.04lts. For a while they all ran fine together till my Windows drive gave out and ever since I tried to remove the drive GRUB recovery has been popping up. I even tried to put the drive back in and the computer still wont boot anything. Ive got 4 different live boots and neither one works, Ive tried to boot with my internal dvd drive and a usb one, there is always a Grub error. When I put in the ls command and find my only non"unknown filesystem" it still says "bad filename". I guess where im getting at is grub wont even let me reformat my computer or boot from anything without saying "no such device: 32d98-e0b3-451b-809b-ae6562ccb701"

View 3 Replies View Related

Slackware :: Slackware Current 64 Bit Wine Sound - Error: Alsa:ALSA_CheckSetVolume Could Not Find '{PCM,Line} Playback Volume' Element

Mar 22, 2011

after update to slackware current 4 days ago i cant get sound working in wine in starcraf 2 i mean i got sound in instalation but not in game and i get error when i wanna configure sound in winecfg

err:alsa:ALSA_CheckSetVolume Could not find '{PCM,Line} Playback Volume' element
err:alsa:ALSA_CheckSetVolume Could not find '{PCM,Line} Playback Volume' element
err:alsa:wine_snd_pcm_recover underrun occurred
err:alsa:wine_snd_pcm_recover underrun occurred

in game i dont got that error but sound dont work btw my sound card is asus xonar essence stx

View 2 Replies View Related

Debian Configuration :: Pppd Dial-in Chat Initializer Script Failed?

Apr 27, 2011

HP ProLiant ML110
Intel(R) Pentium(R) 4 CPU 3.00GHz
External USRobotics V.90 56K FaxModem
Plugged into first serial port
dmesg | grep 'erial'
[ 2.160168] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

[Code]...

View 1 Replies View Related

General :: Search For An Element In File

Jul 27, 2009

I have a doubt, i have a file which contains around 3000 elements, now i want to search for an element in that file.what will be the Efficient way of searching ? without consuming much memory and time..

1) is this efficient if i take all the 3000 elements from file to a list or array and sort them and search ?
2) or is it efficient to search directly inside the file ??
Can anyone please suggest some algorithms for an efficient way to search in this case ?I am using C for coding..

View 14 Replies View Related

General :: Which Element Of Network Refused Connection

Dec 21, 2010

How could I determine, which element of network actually refused/close connection?

View 1 Replies View Related

General :: Using Locate - All Paths That Contain Element /bin/ But Only One Instance Of Each One

Jun 18, 2010

I want to print, using locate, all the paths that contain the element /bin/ but only one instance of each one. If I issue 'locate /bin/' then I have many screens of text with, for example,

/usr/bin/foo1
/usr/bin/foo2
/home/me/bin/foo3
whereas I want to see only
/usr/bin/foo1
/home/bin/foo3

That is to say, if in two lines /bin/ appears with the same prefix (in the example above the prefixes would be /usr and /home/me) I only want to print the first line. Can I pipe locate to grep to do this? I've mentioned locate because it does not scan the whole disk.

View 5 Replies View Related

General :: File Permissions In Every Element Of Path Or Just Last One?

Dec 17, 2010

Kernel 2.6.21.5, slackware 12.0 For a given app run by me as user john to be able to create a file in /foo1/foo2/, what do I need? (a) john to have write permissions in /foo1/? (b) john to have write permissions in /foo1/foo2/? (c) john to have write permissions in both /foo1/ and /foo1/foo2/? Any hint will be welcome. Note: No. It's not homework. KTorrent complains when trying to create the files being downloaded, saying 'permission denied'. But I think he is being run by another user. I can explain in a different thread.

View 3 Replies View Related

General :: Incrementing Array Element In Shell Scripting

Jun 23, 2010

ch[1]=0; ch[2]=0; ch[3]=0; ch[4]=0; ch[5]=0; ch[6]=0; ch[7]=0; ch[8]=0; ch[9]=0; ch[10]=0;ch[11]=0; ch[12]=0; ch[13]=0; ch[14]=0; ch[15]=0 ch[16]=0; ch[17]=0; ch[18]=0; ch[19]=10; ch[20]=0;

I have an array ch and I want to increment each element in my array for the following if statement. I'm not sure I have the right array increment syntax but I have tried it in different ways ant it doesn't seem to work.

I tried ch[$1]++, ch[$1]+1, ch[$1++], ch[$1]+=1, ch[$1]=ch[$1]+1 none of these seem to work.
# while loop reading from read.txt for check list 1 - 15
for i in `seq 15`
do
a=`grep "${cl[$i]}" $file`
status=$?
if [[ $status = 0 ]];
then
echo -n -e "1 "
let ch[$i+1]
let k++
else
echo -n -e "0 "
fi
done
for l in `seq 20`
do
echo -n -e "${ch[$l]} "
done

View 2 Replies View Related







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