LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-03-2004, 01:12 AM   #1
ashwinipahuja
Member
 
Registered: Mar 2004
Posts: 79

Rep: Reputation: 15
Angry Exception handling compilation errors


hello
all
i am working on a project in c++. i am working on the kdevelop having gnu compiler . i want to incorporate exception handling in my program like catch and try but i am getting error at the compilation end . should i have to do some chnages in the kdevelop editor options to get the catch enabled .
waiting for ur reply
 
Old 07-03-2004, 03:29 AM   #2
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Rep: Reputation: 30
I don't think that's necesary, i gues it's just a bug in your code.
Post here your code, maybe that i can help.
Hylke
 
Old 07-03-2004, 04:14 AM   #3
ashwinipahuja
Member
 
Registered: Mar 2004
Posts: 79

Original Poster
Rep: Reputation: 15
Angry attching the code for catch problem in the code , HELp

hello i am adding the source code having the try and catch statement . i get run time error in the statement having catch and the error is "err" is unknown function


int CAssignmentTableStack::getConstantValue(string symbolName, string &number)
{
//returns 1 on successful calculation of constant value
//get the symbol name

string scopedSymbolName;
try
{
scopedSymbolName = m_pElaboration->getScopeResolvedName(symbolName);
}
catch(int err)
{
if(47 == err)
return -3;
else
throw err;
}
if(m_pAssignmentTables->find(scopedSymbolName) == m_pAssignmentTables->end())
{
return 0;
}
//if assignment table found then get the value
CAssignmentTable *tab = (m_pAssignmentTables->find(scopedSymbolName))->second;

//dummy variables to be passed
map<int, BDD*> bddsForWriting;
map<int, CDerivedBus*> conditionsForWriting, feedbackBuses;
CDerivedBus* symbolBus = (CDerivedBus*) m_pBusManager->getBus(scopedSymbolName);
//get msb lsb
const vector<int> &dim = symbolBus->getDimension();
int msb = dim[0];
int lsb = dim[1];
msb = symbolBus->mapUserIndex(msb);
lsb = symbolBus->mapUserIndex(lsb);
int r = tab->getThisRhs(*m_pCond, msb, lsb, *m_pBusManager, feedbackBuses, bddsForWriting, conditionsForWriting);
CDerivedBus *feedbackBus = m_pElaboration->concatBuses(feedbackBuses, symbolBus, msb, lsb);
CPinArray *sourcePort = feedbackBus->getSourcePort();
CHardwareElement *elem = sourcePort->getParent();
bool constant = true;
if( elem->getType() == IK_BUS_MANIPULATOR )
{
vector<CPin*> &inpins = elem->getInputPins();
int size = inpins.size();
int mask = 1;
for(int i = 0; i < size; ++i, mask = mask << 1)
{
CPin *p = inpins[i];
if(p && p->getWire())
{
CWire *w = p->getWire();
CWire::EDataType dType = w->getDataType();
switch(dType)
{
case CWire::GND:
number.insert(number.begin(), '0');
break;
case CWire::VCC:
number.insert(number.begin(), '1');
break;
case CWire:ONT_CARE:
number.insert(number.begin(), '0');
break;
default:
constant = false;
break;
}
}
else
{
constant = false;
}
}
}
else
{
vector<CWire*> &wires = feedbackBus->getWires();
int size = wires.size();
int mask = 1;
for(int i = 0; i < size; ++i, mask = mask << 1)
{
CWire *w = wires[i];
if( w )
{
CWire::EDataType dType = w->getDataType();
switch(dType)
{
case CWire::GND:
number.insert(number.begin(), '0');
break;
case CWire::VCC:
number.insert(number.begin(), '1');
break;
case CWire:ONT_CARE:
number.insert(number.begin(), '0');
break;
default:
constant = false;
break;
}
}
else
{
constant = false;
}
}
}
if(!constant)
return -2;
return 1;
}
 
Old 07-03-2004, 04:49 AM   #4
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Rep: Reputation: 30
Im not really a c++ guru, but if you can comment things and recompile it to check where the problem is.And ofcourse use a debugger(add -g).
Hylke
 
Old 07-03-2004, 04:54 AM   #5
ashwinipahuja
Member
 
Registered: Mar 2004
Posts: 79

Original Poster
Rep: Reputation: 15
hi
how to use the -g command and can u tell me the syntax by taking the example as i am not working on the prompt but on kdevelop .
can u also tell me or send me a make file example and how to write makefile to link different libraries
 
Old 07-03-2004, 05:35 AM   #6
ashwinipahuja
Member
 
Registered: Mar 2004
Posts: 79

Original Poster
Rep: Reputation: 15
hi
how to use the -g command and can u tell me the syntax by taking the example as i am not working on the prompt but on kdevelop .
can u also tell me or send me a make file example and how to write makefile to link different libraries
 
Old 07-03-2004, 06:46 AM   #7
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Rep: Reputation: 30
I think in the linker options, just add -g to it
And im not really an expert of make files, i just use the g++ compiler to compile my source codes without make files.
Hylke
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception Handling vipinsharma Programming 2 09-25-2005 11:05 AM
Exception Handling C++ Hady Programming 3 07-26-2005 11:07 PM
ARRRG at Wine! Unhandled exception errors! Nightmare JG Linux - Software 3 07-12-2005 09:22 AM
errors while handling sys_unlink dypgrp Linux - General 0 02-01-2005 09:57 AM
python; exception handling TheLinuxDuck Programming 2 08-20-2003 02:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration