Problem gcc and std::to_string

bsd4me

Well-Known Member
Hallo,

ich versuche hier eine Software zu compilieren, aber leider komme ich nur zu dem Punkt:

CXX sub_commands/count_main.o
In file included from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/sorted_dumper.hpp:29:0,
from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/text_dumper.hpp:20,
from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/jellyfish.hpp:23,
from sub_commands/count_main.cc:40:
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp: In member function 'jellyfish::RectangularBinaryMatrix jellyfish::file_header::matrix(int) const':
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp:45:13: error: 'to_string' is not a member of 'std'
name += std::to_string((long long int)i); // Cast to make gcc4.4 happy!
^
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp: In member function 'void jellyfish::file_header::matrix(const jellyfish::RectangularBinaryMatrix&, int)':
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp:56:13: error: 'to_string' is not a member of 'std'
name += std::to_string((long long int)i);


hat da jemand eine Idee, was zu tun ist?

das wäre spitze!! LG Norbert
 
Welcher C++ Compiler? Welche Version? Auf welchem System?

to_string ist C++11. Vermutung: Veraltete header files.
 
mhhmmm... FreeBSD 10.1 RC2, habe gcc46, gcc48 und auch gcc5 verwendet. Auch mal -std=c++11 versucht... aber irgendwie bleib der immer wieder da hängen.
reicht Dir das an info?
 
Hat's einen besonderen Grund, dass du g++ verwendest? Also bei mir (10.0/clang) ist to_string(long long) wie sich's gehört im string include deklariert (in /usr/include/c++/v1/string). Für g++ kann ich's gerade nicht prüfen.

Ich würde mal gucken, wo der Compiler überall nach includes sucht. Und clang verwenden.

Ach und: In /etc/make.conf alles richtig eingetragen?

Davon, dir schnell mit tricksen zu behelfen (z.B. korrekte Deklaration einfach per Hand einzutragen) würde ich abraten, weil a) es dann ziemlich wahrscheinlich beim Linken hakelt und b) FreeBSD die Umstellung auf clang wohl noch nicht in allen Eckchen 100% rund hat (weswegen ich auch von g++ abraten würde).

Viel Erfolg!
 
Weil die Software den gcc "erwartet"...

Aber mit cc sieht es so aus:

In file included from ./KmerCounter.hpp:53:
/usr/include/c++/v1/ext/hash_map:212:5: warning: Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
[-W#warnings]
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
^
IRKE.cpp:31:1: warning: typedef requires a name [-Wmissing-declarations]
typedef struct iworm_tmp_file { //FIXME: make a class for this
^~~~~~~
IRKE.cpp:89:5: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::MAX_THREADS_READ_PARSING); // place limit here because performance deteriorates beyond t...
^
IRKE.cpp:151:5: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::NUM_THREADS);
^
IRKE.cpp:461:9: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::NUM_THREADS);
^
IRKE.cpp:464:9: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(1); // turn off multithreading for the contig building.
^
2 warnings and 4 errors generated.
 
Hallo,

ich versuche hier eine Software zu compilieren, aber leider komme ich nur zu dem Punkt:

CXX sub_commands/count_main.o
In file included from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/sorted_dumper.hpp:29:0,
from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/text_dumper.hpp:20,
from /bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/jellyfish.hpp:23,
from sub_commands/count_main.cc:40:
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp: In member function 'jellyfish::RectangularBinaryMatrix jellyfish::file_header::matrix(int) const':
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp:45:13: error: 'to_string' is not a member of 'std'
name += std::to_string((long long int)i); // Cast to make gcc4.4 happy!
^
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp: In member function 'void jellyfish::file_header::matrix(const jellyfish::RectangularBinaryMatrix&, int)':
/bioappl/src/trinity/trinityrnaseq_r20140717/trinity-plugins/tmp.jellyfish/include/jellyfish/file_header.hpp:56:13: error: 'to_string' is not a member of 'std'
name += std::to_string((long long int)i);


hat da jemand eine Idee, was zu tun ist?

Code:
#define _GLIBCXX_USE_C99 1
in die anwendung am Anfang reinpatchen.
FreeBSD unterstützt vom System her bestimmte Teile von C99 nicht, weswegen das nicht gesetzt ist. Wenn man es erzwingt geht aber zumindest der ganze to_string Kram.

edit: hat nichts mit C++11 zu tun.
 
Weil die Software den gcc "erwartet"...

Aber mit cc sieht es so aus:

In file included from ./KmerCounter.hpp:53:
/usr/include/c++/v1/ext/hash_map:212:5: warning: Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
[-W#warnings]
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
^
IRKE.cpp:31:1: warning: typedef requires a name [-Wmissing-declarations]
typedef struct iworm_tmp_file { //FIXME: make a class for this
^~~~~~~
IRKE.cpp:89:5: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::MAX_THREADS_READ_PARSING); // place limit here because performance deteriorates beyond t...
^
IRKE.cpp:151:5: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::NUM_THREADS);
^
IRKE.cpp:461:9: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(IRKE_COMMON::NUM_THREADS);
^
IRKE.cpp:464:9: error: use of undeclared identifier 'omp_set_num_threads'
omp_set_num_threads(1); // turn off multithreading for the contig building.
^
2 warnings and 4 errors generated.

Das sieht so aus, als käme OpenMP zum Einsatz, und AFAIK wird das von Clang noch nicht unterstützt.
Aber auf meinem FreeBSD 10.0 RELEASE stören sich weder clang++ 3.3 noch 3.5 an std::to_string, g++ 4.8 hingegen schon.
Daher glaube ich eher, dass das an den seltsamen GNU headern liegt als an FreeBSD.

Code:
#include <string>
#include <iostream>

int main(void)
{
    int i = 23;
    std::string s = std::to_string(i);

    std::cout << s << std::endl;
    return 0;
}

$ clang++ --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd10.0
Thread model: posix
$ clang++ -Wall t.cc
$ ./a.out
23
$ clang++35 -Wall t.cc
$ ./a.out
23
$ g++48 -Wall t.cc
t.cc: In function 'int main()':
t.cc:7:21: error: 'to_string' is not a member of 'std'
std::string s = std::to_string(i);
 
@h^2: supie :-) Danke! Habe die Stelle gefunden und nun rennt es...

@goblin: danke, aber es scheint auch erstmal mit gcc zu funktionieren...

LG Norbert
 
Zurück
Oben