C/C++ :: How To Throw Error In COM DLL

Feb 3, 2015

i made a ActiveX Library with C++ Builder XE3 for use in VB6

i want to throw a error like the dao360.dll do (VB6 stop on the correct line) not just show a messagebox

i try to many different "throw" (EOleException, EOleSysError, ..) but it always crash VB6

if i use SetErrorInfo or this->Error(), nothing happen

i cannot return a HRESULT my fonction return a Database* (the name of my CoClass)

View 14 Replies


ADVERTISEMENT

C++ :: How To Insert Try / Catch Throw

May 3, 2013

I have this code I wrote with some data and what I'm supposed to do is insert exception handling into the code. The problem is I've seen the basic examples of it. But I don't know how to implement it into my code.

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main(){
string filename, n;
cout << "To find a file, type in the file name. " <<endl;

[Code] .....

And the file is:
A
F
D
E
U
B
V
X
M
V

View 10 Replies View Related

C++ :: Can't Throw Exception In Template

Feb 24, 2013

I'm making an "improved" array for my programing class. It's currently unfinished, so you might see some commented out code. I'm trying to debug what I have.

I keep getting these errors when I try to complile my main.cpp:

In file included from main.cpp:3:0:

array.h:107:43: error: expected type-specifier before ‘out_of_range’
array.h:107:43: error: expected ‘)’ before ‘out_of_range’
array.h:107:43: error: expected initializer before ‘out_of_range’
array.h:121:55: error: expected type-specifier before ‘out_of_range’
array.h:121:55: error: expected ‘)’ before ‘out_of_range’
array.h:121:55: error: expected initializer before ‘out_of_range’

My main file:

#include <iostream>
#include <stdexcept>
#include "array.h"
using namespace std;
using namespace ArrayNameSpace;
int main()
{
Array<int> testSubject(5);
return 0;
}//End main

aannnd my Array.h file:

//ADD CONSTS TO METHODS
//CURRENTLY WORKING ON EXCEPTIONS AND BRACKET[] OVERLOADS. I HAVE TO FIGURE OUT SOLUTIONS FOR REACHING
//INDEXES FOR CHARS AND ENUMS
#ifndef __array_H__
#define __array_H__
#include <stdexcept>
namespace ArrayNameSpace
{

[code]....

View 3 Replies View Related

C :: Sort The Array Values Then Throw Out First And Last Value

May 1, 2014

This program is suppose to sort the array values then throw out the first and last value. It does not seem to do doing this.

Code:
# include <stdio.h>02
void bubbleSort(float judges[], float array);
03
int main (void){

[code] .....

View 3 Replies View Related

C/C++ :: Getting Header Error C2447 / Can't Find Error Source

Sep 8, 2014

Cannot manage to find the error source when i try running the program, the first part of the program runs just fine its when i try to get the temperature one that i get the error

#include <iostream>
#define pi 3.141592
using namespace std;
int main() {
double r, h; //declare variables for radious and height
double Surfacearea;

[code]....

View 1 Replies View Related

C++ :: Error C2061 / Syntax Error - Identifier (string)

Apr 3, 2013

I've just recently started to learn C++, and I'm encountering some errors I can't seem to figure out.

InventoryItem.h:

Code:
#pragma once
class InventoryItem {
public:
InventoryItem(string name, int amount);
~InventoryItem(void);
string getName(void);
int getAmount(void);

[code].....

Errors:

Code:
1>d:c++consoleapplicationconsoleapplicationinventoryitem.h(6): error C2061: syntax error : identifier 'string'
1>d:c++consoleapplicationconsoleapplicationinventoryitem.h(8): error C2146: syntax error : missing ';' before identifier 'getName'

[Code] .....

View 14 Replies View Related

C++ :: Error With Binary IO

Jan 6, 2015

I am trying to make a program like a virtual machine, and therefore I need to have a virtual hard drive. I have it split across four files, each being exactly 67,108,864 bytes (at this point, the files consist of 0x00 throughout the entire file). When I try to write to the beginning of one of the files, I get a "EXC_BAD_ACCESS (code=1, address=0xff)" from Xcode.

Here is my source code.

Code: #include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream drive1("main1.vhd", ios::in | ios::out | ios::binary);
fstream drive2("main2.vhd", ios::in | ios::out | ios::binary);
fstream drive3("main3.vhd", ios::in | ios::out | ios::binary);
fstream drive4("main4.vhd", ios::in | ios::out | ios::binary);

[code]....

View 4 Replies View Related

C++ :: Error - Void Value Not Ignored As It Ought To Be

May 4, 2014

Using a template in the assignment, I don't know what I did wrong?

Code:
#include <iostream>
#include <string>
using namespace std;
template<class T>
void mpgcalc(T& Miles, T& Gallons)

[Code] .....

View 2 Replies View Related

C :: Type Of Error In MCQ

Jun 13, 2013

Q. Consider the following C declaration.
int x[10], y,z;

What kind of error does following statement contain?
z == x +y;

a. Syntax error
b. Semantic error
c. logical error
d. All of the above

According to me it should be option a, but I am confused, how to get confirm answer with explanation.

View 11 Replies View Related

C :: Error Going In A Function

Jul 2, 2013

I have no error compiling, but running my project it stops before entering a function and debugging I have an error about Segmentation fault. The function:

Code:
1
2
3
4
5
6
7
Mat logGabor(matriz filter,Mat filter,double r_o,double theta_o,double sigma_theta, matriz radius,matriz theta,int cols,int rows,double sigma_r,int *padSize){

[Code]....

View 5 Replies View Related

C :: How To See Divide Error

Sep 22, 2013

i was suppose to write a program that gives a divide error but output is not showing anything like it.I am using orwell devc++ 5.4.2 and all the default built tools(gcc compiler etc.) with default settings.so, what should i do to see this error?

Code:

#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
float x;
}

[code]....

View 9 Replies View Related

C :: Getting Error On Matrix

Mar 6, 2015

I've a code and it works on my linux laptop; however it doesnt work on a matrix server. Im getting error Code: file.c: In function CondCheck:file.c:40:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default] The code of the programme

Code:

#include <stdio.h>
#include <string.h>
#include <math.h>
/*DECIMAL TO BINARY CONVERTER*/
int BinaryConverter (int bina)
}

[code]....

View 1 Replies View Related

C :: Do While Loop Error

Feb 19, 2015

While trying to redo everything in c i have an error on a do while loop and i don't understand i've corrected everything else but i don't understand why the error occurs even though it says how to fix it it says error expected ) before token -line 18 part of code

Code:

int main(){
Beep (523,1000); // sound at 523 hertz for 1 000 milliseconds
char cPresent;
do
}

[code]....

this is just extra bits i've added on to the assignment but I've worked on the c++ code for a week now i have less than a day to redo it

View 2 Replies View Related

C++ :: Error While Making DLL

Dec 17, 2013

So I tried to find some youtube videos on how to make a DLL, I found one, I also found several topics (like on msdn and stuff), but I have this code

header

#include <WinSock2.h>
#include <WS2tcpip.h>
#include <Windows.h>
#include <string>
using namespace std;

#pragma comment(lib, "ws2_32.lib")

[Code] ....

And I'm getting these errors:

1>error LNK2001: unresolved external symbol "private: static char * PathSocket::cBuffer" (?cBuffer@PathSocket@@0PADA)
error LNK2001: unresolved external symbol "private: static unsigned int * PathSocket::socket" (?socket@PathSocket@@0PAIA)
error LNK2001: unresolved external symbol "private: static void * PathSocket::hIDTask" (?hIDTask@PathSocket@@0PAXA)

WHY is there static, and what does dllimport/dllexport does? also there are NO tutorials with variables inside dll >.<

I've been following this [URL] ..... and the video I already lost, however there's no

#ifdef MATHFUNCSDLL_EXPORTS
#define MATHFUNCSDLL_API __declspec(dllexport)
#else
#define MATHFUNCSDLL_API __declspec(dllimport)
#endif

in the video, why do we have to use that? [URL] .....

View 19 Replies View Related

C++ :: Error - Else With No Matching If

Feb 11, 2013

Here is my first program, I had to use a lot of if/ else statements. For some reason the last "else" (bolded) is giving me an error and not letting me run the program.

#include <iostream>
using namespace std;

const float MILES_PER_KM = 1.0 / 1.61;
const float KM_PER_MILE = 1.61;
const float FREEZING_F = 32.0;
const float FAHR_PER_CELSIUS = 9.0 / 5.0;
const float CELSIUS_PER_FAHR = 5.0 / 9.0;
const float MAX_F_TEMP = 100.0;
const float MIN_F_TEMP = 0.0;

[Code] ....

And yes, the if else's are indented properly, because there are no errors for the first 3 unit types, only for the last one ( 'F' ), and i have them all exactly in the same format.

View 5 Replies View Related

C++ :: Error In A Vector

Jun 2, 2014

I am writing a c++ program which uses a vector which contains rows and columns of a table.Unfortunately I got the following error:

IntelliSense: no instance of overloaded function "std::vector<_Ty, _Alloc>::push_back [with _Ty=CCellDescr *, _Alloc=std::allocator<CCellDescr *>]" matches the argument list

argument types are: (const CCellDescr)
object type is: std::vector<CCellDescr *, std::allocator<CCellDescr *>>Here`s the code:

#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<iterator>
using namespace std;

[code].....

View 1 Replies View Related

C++ :: Error With Value Being Returned

Nov 18, 2013

I am working on my final project for my class and after finally getting it to compile with no errors to finding examples/tutorials and following skeleton code I cam encountering a problem.

The program runs, asks all the correct questions but when it displays the base pay and total pay for all 3 employees it comes back as ( -1.0743 blah blah )

When they work over 40 hours it works correctly but when they work under 40 hours it displays those weird numbers in those sections.

// Kevin Johnson -- Overtime Pay -- Final Assignment
// Created 11/14/2013 // Edited 11/17/2013
#include "stdafx.h"

[Code]....

View 9 Replies View Related

C/C++ :: Error Compiling A DLL

Jul 25, 2014

I'm having a constant error in my DLL regarding one simple function: I get the error:

double *(double)' differs in levels of indirection from 'double (double)'

The declaration is:

extern EXP32 double *FAR PASCAL_CONV utc2tdb(double jd);

What can be the problem?

View 1 Replies View Related

C/C++ :: Can't Run The Program Because Of Error

Nov 15, 2014

my code is :
#include<stdio.h>
int main();
{
printf("????
");
return 0;
}

error: expected identifier or '(' before '{' token
what do I have to do to run it?

View 1 Replies View Related

C/C++ :: Getting Error While Using OpenMP Along With Map

Dec 19, 2012

I am using map for assigning an identifiers for a line from file in c++. Also i am using IDs for a pattern in line {name, operator, val} which is separated by ';'. I am using read_pub() for calculating how many patterns are there in a line.
 
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<fstream>
#include<omp.h>
#include<map>
#include <sstream>  
using namespace std;
struct predicate {

[Code] ....

View 1 Replies View Related

C++ :: Error When Using Wmemcpy

Sep 17, 2012

Code:

struct DeviceParam {
UINT32 count;
UINT32 selection;
wchar_t *MyStrings[MAX_DEVICES];

[Code] .....

When I compile the code i get the following error ,

An unhandled exception of type 'System.AccessViolationException' occurred in TestLib.exe

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

View 1 Replies View Related

C++ :: Error Message While Debugging

Mar 17, 2013

I'm getting an error message that I can't seem to fix. The error clearly states that during the link aspect of the debugging and build there is an error that says that the stdio.h file is either missing, invalid or corrupt. When I try to program using any of the other headers I'm getting the same error. The files are there I can see them in the include folder, so I'm asking what can I do to fix all these headers and beware I am a beginner at programming and using any kind of compiler.

This is the error I receive.
1>------ Build started: Project: hello, Configuration: Debug Win32 ------ 1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========

This is the compiler I am required to use for an online course and all instruction is given for the Microsoft visual 2010 express edition. Also the only file I think that's being referenced is the #include <stdio.h>.

View 1 Replies View Related

C++ :: Error Entering A Function?

Jul 2, 2013

I have no error compiling, but running my project it stops before entering a function and debugging I have an error about Segmentation fault. The function:

Code:

Mat logGabor(matriz filter,Mat filter,double r_o,double theta_o,double sigma_theta,
matriz radius,matriz theta,int cols,int rows,double sigma_r,int *padSize){
Mat rpad;
int k=*padSize;
printf("Welcome to the function"); //Here the error
...

More info: I created the matriz as : typedef double** matriz;
and a createmat function that give back a double** and in this function I allocate space for matriz and works. In the main:

Code:
Mat chr-Rpad[4][5]; //chrOrient=4;chrScales=5
for(int i_or=1;i_or<chrOrient;i_or++){
for(int i_sc=1;i_sc<chrScales;i_sc++){
//some math calculation
chrRpad[i_or-1][i_sc-1]=abs(logGabor(filter,imftt2,r_o,theta_o,sigma_theta,radius,theta,cols,rows,sigma_r,padSize));

View 6 Replies View Related

C++ :: Getting Error Using Enum In If Statement?

Jan 19, 2014

I'm trying to make a simple C++ program in which the user must try to guess a number, if they guess too high it says "too high" and if they guess too low it says "too low".

I also decided to add a feature which allows them to select how many tries they would like to guess the number. I tried to make "tries" type an enum so if the user could not pick an invalid number but for some reason i cannot use it in an if statement.

here is the code and i am getting the first error on line 27:

Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int guess;

[Code]....

View 7 Replies View Related

C# :: Index Out Of Bounds Error

Jun 27, 2014

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chapter7Problem13

[Code] .....

I keep getting an out of bounds error in my code

I'm suppose to enter number of orders then enter those orders then calculate a discount and net price display the orders, discount, net price then the totals at the bottom ....

View 5 Replies View Related

C :: Syntax Error In Expression Near If

Feb 3, 2013

I am using code::blocks for c programming and when i take debugger in below code it show ..

a syntax error in expression near "if"..

I am just checking debugger ...

Code:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[100];

[Code] ....

View 7 Replies View Related







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