Re: Question about class Array
Paul Miller <[email protected]> Thu, 26 Oct 2017 09:27:12 -0500
| Newsgroups | gmane.comp.video.openexr.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============7743933919568191462==
Content-Type: multipart/alternative;
boundary="------------D6B7144653886820A091F2E6"
Content-Language: en-US
This is a multi-part message in MIME format.
--------------D6B7144653886820A091F2E6
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Array is inside a namespace defined by the EXR headers - it's usually "Imf".
See |OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER|
So you should use Imf::Array<>.
On 10/26/17 1:01 AM, qtech qtech wrote:
>
> I am an inexperienced programmer trying to build and use openexr. I
> think my main problem is the linking. So I have this header file:
>
> |#ifndef INCLUDED_IMF_ARRAY_H #define INCLUDED_IMF_ARRAY_H #include
> "ImfForward.h" OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER template
> <class T> class Array { public: Array () {_data = 0; _size = 0;} Array
> (long size) {_data = new T[size]; _size = size;} ~Array () {delete []
> _data;} operator T * () {return _data;} operator const T * () const
> {return _data;} void resizeErase (long size); void resizeEraseUnsafe
> (long size); long size() const {return _size;} private: Array (const
> Array &); Array & operator = (const Array &); long _size; T * _data; }; |
>
> and my main file is
>
> |#include <iostream> #include <OpenEXR/ImfArray.h> using namespace std;
> struct C { C () {std::cout << "C::C (" << this << ")\n";}; virtual ~C
> () {std::cout << "C::~C (" << this << ")\n";}; }; int main () { Array
> <C> a(3); C &b = a[1]; const C &c = a[1]; C *d = a + 2; const C *e =
> a; return 0; } |
>
> I keep getting the following error "‘Array’ was not declared in this
> scope"... I would really appreciate your help! Thank you in advance
>
> Thank you,
> Stelio
>
>
> _______________________________________________
> Openexr-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/openexr-devel
--------------D6B7144653886820A091F2E6
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Array is inside a namespace defined by the EXR headers - it's
usually "Imf".<br>
</p>
<p>See <code>OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER</code></p>
So you should use Imf::Array<>.<br>
<br>
<div class="moz-cite-prefix">On 10/26/17 1:01 AM, qtech qtech wrote:<br>
</div>
<blockquote type="cite"
cite="mid:HE1PR02MB122648AF1F99F70024A8BD27C8450@HE1PR02MB1226.eurprd02.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div class="gmail-post-text">
<p>I am an inexperienced programmer trying to build and use
openexr. I think my main problem is the linking. So I have
this header file:</p>
<pre><code>#ifndef INCLUDED_IMF_ARRAY_H
#define INCLUDED_IMF_ARRAY_H
#include "ImfForward.h"
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
template <class T>
class Array
{
public:
Array () {_data = 0; _size = 0;}
Array (long size) {_data = new T[size]; _size = size;}
~Array () {delete [] _data;}
operator T * () {return _data;}
operator const T * () const {return _data;}
void resizeErase (long size);
void resizeEraseUnsafe (long size);
long size() const {return _size;}
private:
Array (const Array &);
Array & operator = (const Array &);
long _size;
T * _data;
};
</code></pre>
<p>and my main file is </p>
<pre><code>#include <iostream>
#include <OpenEXR/ImfArray.h>
using namespace std;
struct C
{
C () {std::cout << "C::C (" << this << ")\n";};
virtual ~C () {std::cout << "C::~C (" << this << ")\n";};
};
int main ()
{
Array <C> a(3);
C &b = a[1];
const C &c = a[1];
C *d = a + 2;
const C *e = a;
return 0;
}
</code></pre>
<p>I keep getting the following error "‘Array’ was not
declared in this scope"... I would really appreciate your
help! Thank you in advance</p>
</div>
<div>
<div class="gmail_signature">
<div dir="ltr">
<div style="font-size:12.8px">Thank you,</div>
<div style="font-size:12.8px">Stelio</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Openexr-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.nongnu.org/mailman/listinfo/openexr-devel">https://lists.nongnu.org/mailman/listinfo/openexr-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>
--------------D6B7144653886820A091F2E6--
--===============7743933919568191462==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Openexr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/openexr-devel
--===============7743933919568191462==--