bamtools API compilation

74 views
Skip to first unread message

km

unread,
Dec 20, 2012, 6:17:45 AM12/20/12
to bamtoo...@googlegroups.com

Dear All,

I am trying to compile the following program using bamtools  API (below).

But then It ends up with following error. In summary it fails  to compile with g++ (v4.6/v4.7).
Looks like std namespace is ovewritten and hence "cout" is not recognized.
Please let me know how to rectify this error.

Error is
##########error ##############
In file included from /usr/include/c++/4.6/ext/new_allocator.h:34:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:34,
                 from /usr/include/c++/4.6/bits/allocator.h:48,
                 from /usr/include/c++/4.6/string:43,
                 from /usr/include/c++/4.6/stdexcept:40,
                 from ./shared/bamtools_global.h:91,
                 from ./api/api_global.h:13,
                 from api/BamReader.h:13,
                 from mybam.cc:1:
./new:2:1: error: ‘cout’ does not name a type
In file included from /usr/include/c++/4.6/bits/stl_construct.h:61:0,
                 from /usr/include/c++/4.6/vector:63,
                 from ./api/BamAux.h:18,
                 from ./api/BamAlignment.h:14,
                 from api/BamReader.h:14,
                 from mybam.cc:1:
./new:1:7: error: redefinition of ‘char* pwd’
./new:1:7: error: ‘char* pwd’ previously defined here
./new:2:1: error: ‘cout’ does not name a type
##########error ###############

The program is
######### program ########
#include "api/BamReader.h"
#include <iostream>

using namespace BamTools;

int main(int  argc, char *argv[])
{
BamReader read;
if(!read.Open(argv[1])){
    exit(0);
}

BamAlignment bal;
while(read.GetNextAlignmentCore(bal)){
    if(bal.MapQuality >= 80) {
       
    }

}

return 0;
}
########## program ##############

Regards,
KM

km

unread,
Dec 20, 2012, 9:04:39 AM12/20/12
to Michael Siebauer, bamtoo...@googlegroups.com
Hi Michael,

nope. it gives me the same error :

In file included from /usr/include/c++/4.6/ext/new_allocator.h:34:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:34,
                 from /usr/include/c++/4.6/bits/allocator.h:48,
                 from /usr/include/c++/4.6/string:43,
                 from /usr/include/c++/4.6/bits/locale_classes.h:42,
                 from /usr/include/c++/4.6/bits/ios_base.h:43,
                 from /usr/include/c++/4.6/ios:43,
                 from /usr/include/c++/4.6/ostream:40,
                 from /usr/include/c++/4.6/iostream:40,
                 from mybam.cc:2:

./new:2:1: error: ‘cout’ does not name a type
In file included from /usr/include/c++/4.6/bits/stl_construct.h:61:0,
                 from /usr/include/c++/4.6/vector:63,
                 from ./api/BamAux.h:18,
                 from ./api/BamAlignment.h:14,
                 from ./api/BamReader.h:14,
                 from api/BamMultiReader.h:14,
                 from mybam.cc:5:

./new:1:7: error: redefinition of ‘char* pwd’
./new:1:7: error: ‘char* pwd’ previously defined here
./new:2:1: error: ‘cout’ does not name a type

Regards,
KM


On Thu, Dec 20, 2012 at 7:03 PM, Michael Siebauer <michael....@googlemail.com> wrote:
Hi,

Try to change the namespace ordering this way.

#include <cstdio>
#include <iostream>
using namespace std;

#include "api/BamMultiReader.h"
using namespace BamTools;


Cheers.

Derek Barnett

unread,
Dec 20, 2012, 10:26:56 AM12/20/12
to bamtoo...@googlegroups.com
Hi KM,
I haven't been able to reproduce your problem from here, so I can only toss out ideas.
Perhaps try doing a 'make clean' on your project and/or BamTools, and then rebuild.

� - Derek



On 12/20/2012 09:04 AM, km wrote:
Hi Michael,

nope. it gives me the same error :

In file included from /usr/include/c++/4.6/ext/new_allocator.h:34:0,
���������������� from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:34,
���������������� from /usr/include/c++/4.6/bits/allocator.h:48,
���������������� from /usr/include/c++/4.6/string:43,
���������������� from /usr/include/c++/4.6/bits/locale_classes.h:42,
���������������� from /usr/include/c++/4.6/bits/ios_base.h:43,
���������������� from /usr/include/c++/4.6/ios:43,
���������������� from /usr/include/c++/4.6/ostream:40,
���������������� from /usr/include/c++/4.6/iostream:40,
���������������� from mybam.cc:2:
./new:2:1: error: �cout� does not name a type

In file included from /usr/include/c++/4.6/bits/stl_construct.h:61:0,
���������������� from /usr/include/c++/4.6/vector:63,
���������������� from ./api/BamAux.h:18,
���������������� from ./api/BamAlignment.h:14,
���������������� from ./api/BamReader.h:14,
���������������� from api/BamMultiReader.h:14,
���������������� from mybam.cc:5:
./new:1:7: error: redefinition of �char* pwd�
./new:1:7: error: �char* pwd� previously defined here
./new:2:1: error: �cout� does not name a type

Regards,
KM


On Thu, Dec 20, 2012 at 7:03 PM, Michael Siebauer <michael....@googlemail.com> wrote:
Hi,

Try to change the namespace ordering this way.

#include <cstdio>
#include <iostream>
using namespace std;

#include "api/BamMultiReader.h"
using namespace BamTools;


Cheers.

Am 20.12.2012 12:17, schrieb km:

Dear All,

I am trying to compile the following program using bamtools� API (below).

But then It ends up with following error. In summary it fails� to compile with g++ (v4.6/v4.7).

Looks like std namespace is ovewritten and hence "cout" is not recognized.
Please let me know how to rectify this error.

Error is
##########error ##############
In file included from /usr/include/c++/4.6/ext/new_allocator.h:34:0,
���������������� from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:34,
���������������� from /usr/include/c++/4.6/bits/allocator.h:48,
���������������� from /usr/include/c++/4.6/string:43,
���������������� from /usr/include/c++/4.6/stdexcept:40,
���������������� from ./shared/bamtools_global.h:91,
���������������� from ./api/api_global.h:13,
���������������� from api/BamReader.h:13,
���������������� from mybam.cc:1:
./new:2:1: error: �cout� does not name a type

In file included from /usr/include/c++/4.6/bits/stl_construct.h:61:0,
���������������� from /usr/include/c++/4.6/vector:63,
���������������� from ./api/BamAux.h:18,
���������������� from ./api/BamAlignment.h:14,
���������������� from api/BamReader.h:14,
���������������� from mybam.cc:1:
./new:1:7: error: redefinition of �char* pwd�
./new:1:7: error: �char* pwd� previously defined here
./new:2:1: error: �cout� does not name a type

##########error ###############

The program is
######### program ########
#include "api/BamReader.h"
#include <iostream>

using namespace BamTools;

int main(int� argc, char *argv[])

{
BamReader read;
if(!read.Open(argv[1])){
��� exit(0);
}

BamAlignment bal;
while(read.GetNextAlignmentCore(bal)){
��� if(bal.MapQuality >= 80) {
�������
��� }
Reply all
Reply to author
Forward
0 new messages