need help

I am new to using HDF5 data.
I have just tried to open and close a hdf5 file using the following code-

···

--------------------------------------------------
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

const H5std_string
FILE_NAME("/usr1/Preeti/HDFdata/3DSND_13NOV2013_0000_L1B_SA1.h5")

int main(){
        H5File file(FILE_NAME,H5F_ACC_RDONLY);
        file.close();
        return 0;
}
------------------------------------------------------------------------------------------------------------

but on compiling it gives me following error

[X@Y ~/H5exercise]$ g++ -o readh5 readh5.cpp
In file included from readh5.cpp:7:
/usr/local/include/H5File.h:24: error: expected initializer before ‘:’ token
readh5.cpp:16: error: expected ‘}’ at end of input

Kindly help me

Looks to me like you need a ';' after FILE_NAME's declaration.

···

On Tue, Nov 19, 2013 at 6:37 AM, Preeti <sacpreeti@gmail.com> wrote:

I am new to using HDF5 data.
I have just tried to open and close a hdf5 file using the following code-
--------------------------------------------------
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

const H5std_string
FILE_NAME("/usr1/Preeti/HDFdata/3DSND_13NOV2013_0000_L1B_SA1.h5")

int main(){
        H5File file(FILE_NAME,H5F_ACC_RDONLY);
        file.close();
        return 0;
}

------------------------------------------------------------------------------------------------------------

but on compiling it gives me following error

[X@Y ~/H5exercise]$ g++ -o readh5 readh5.cpp
In file included from readh5.cpp:7:
/usr/local/include/H5File.h:24: error: expected initializer before ‘:’
token
readh5.cpp:16: error: expected ‘}’ at end of input

Kindly help me

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org

http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Thanks a lot for your reply but I am getting the same error on using following code also:

#include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

int main(){
        //H5File file(FILE_NAME,H5F_ACC_RDONLY);
        //file.close();
        return 0;
}

Is that a bug in H5File.h itself....?

···

Sent from my iPad

On 19-Nov-2013, at 9:34 PM, Josiah Slack <josiahnmi@gmail.com> wrote:

Looks to me like you need a ';' after FILE_NAME's declaration.

On Tue, Nov 19, 2013 at 6:37 AM, Preeti <sacpreeti@gmail.com> wrote:

I am new to using HDF5 data.
I have just tried to open and close a hdf5 file using the following code-
include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

const H5std_string
FILE_NAME("/usr1/Preeti/HDFdata/3DSND_13NOV2013_0000_L1B_SA1.h5")

int main(){
        H5File file(FILE_NAME,H5F_ACC_RDONLY);
        file.close();
        return 0;
}
------------------------------------------------------------------------------------------------------------

but on compiling it gives me following error

[X@Y ~/H5exercise]$ g++ -o readh5 readh5.cpp
In file included from readh5.cpp:7:
/usr/local/include/H5File.h:24: error: expected initializer before ‘:’ token
readh5.cpp:16: error: expected ‘}’ at end of input

Kindly help me

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Hi Josiah,

Please try removing

#include"H5File.h"
#include"H5Exception.h"

and including this instead:

#include "H5Cpp.h"

Thanks,

Binh-Minh

···

________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Pahal Tahlani <sacpreeti@gmail.com>
Sent: Tuesday, November 19, 2013 10:52 PM
To: Josiah Slack
Cc: HDF Users Discussion List
Subject: Re: [Hdf-forum] need help

Thanks a lot for your reply but I am getting the same error on using following code also:

#include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

int main(){
        //H5File file(FILE_NAME,H5F_ACC_RDONLY);
        //file.close();
        return 0;
}

Is that a bug in H5File.h itself....?

Sent from my iPad

On 19-Nov-2013, at 9:34 PM, Josiah Slack <josiahnmi@gmail.com<mailto:josiahnmi@gmail.com>> wrote:

Looks to me like you need a ';' after FILE_NAME's declaration.

On Tue, Nov 19, 2013 at 6:37 AM, Preeti <sacpreeti@gmail.com<mailto:sacpreeti@gmail.com>> wrote:
I am new to using HDF5 data.
I have just tried to open and close a hdf5 file using the following code-
include<string>
#include<cstdlib>

using namespace std;

#include"H5File.h"
#include"H5Exception.h"

const H5std_string
FILE_NAME("/usr1/Preeti/HDFdata/3DSND_13NOV2013_0000_L1B_SA1.h5")

int main(){
        H5File file(FILE_NAME,H5F_ACC_RDONLY);
        file.close();
        return 0;
}
------------------------------------------------------------------------------------------------------------

but on compiling it gives me following error

[X@Y ~/H5exercise]$ g++ -o readh5 readh5.cpp
In file included from readh5.cpp:7:
/usr/local/include/H5File.h:24: error: expected initializer before ':' token
readh5.cpp:16: error: expected '}' at end of input

Kindly help me

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

My general approach to HDF5 header file is to only include the top level hdf5.h

#include <hdf5.h>

and leave it to the HDF5 developer to order the required headers within hdf5.h

The other thing is that I only specify name space **after** #include for clarity.

Hope that helps in some ways.

Cheers

···

On 20/11/13 2:52 PM, Pahal Tahlani wrote:

Thanks a lot for your reply but I am getting the same error on using following code also:

    #include<string>
    #include<cstdlib>

    using namespace std;

    #include"H5File.h"
    #include"H5Exception.h"

    int main(){
            //H5File file(FILE_NAME,H5F_ACC_RDONLY);
            //file.close();

            return 0;
    }

Is that a bug in H5File.h itself....?

--
Nicholas Yue
Graphics - RenderMan, Visualization, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue