libstdc++

linker problem with libstdc++.so.6 in connection with cuda

僤鯓⒐⒋嵵緔 提交于 2019-12-05 13:33:14
today i encountered a problem with linking my compiled cuda stuff. i have a uptodate debian testing w/ 2.6.32-3-amd64. i worked all day on my code. compiling from time to time. had no problem. but then after a minor code change i got following error: gcc -o pa CUDA.o histogram256.o histogram64.o main.o -lrt -lm -lcudart -I. -I/data/cuda/include -I/data/cuda/C/common/inc -L/data/cuda/lib64 /usr/bin/ld: main.o: undefined reference to symbol 'std::basic_ifstream<char, std::char_traits<char> >::close()@@GLIBCXX_3.4' /usr/bin/ld: note: 'std::basic_ifstream<char, std::char_traits<char> >::close()@

`cosf`, `sinf`, etc. are not in `std` [duplicate]

人走茶凉 提交于 2019-12-05 12:35:22
问题 This question already has answers here : std::expf and std::logf not recognized by gcc 7.2.0 (4 answers) Closed 6 months ago . Based on the discussion here, I have reported a bug to the Ubuntu developers. When compiling the following sample c++ program: #include <cmath> #include <stdio.h> int main() { printf("%f\n", std::cosf(0.0f)); } I get the following error message: error: ‘cosf’ is not a member of ‘std’ Including math.h and using the non-namespaced version works fine. What is going on? I

C++: How to force libc declarations into std::?

不想你离开。 提交于 2019-12-05 11:07:13
So, I find myself in the need of libc in my C++ program. However, I do not like the idea of sprinkling it all over the global namespace. Ideally, I'd like to force the entirety of libc into the std:: namespace so I'd have to do std::memcpy rather than memcpy . Is this possible? And how? I'm willing to use compiler-specific macros if needed (I target only MS VC++ 10.0 and GCC 4.6). Edit: I do literally mean 'force the declarations into std' - so that they are uncallable without the std:: prefix. Also, I am including cstdio , not stdio.h . Thanks! You cannot do this, unless it's already done.

clang 3.3/Xcode & libc++: std::getline does not read data after calling ifstream::clear()

半城伤御伤魂 提交于 2019-12-05 10:51:19
The following program demonstrates an inconsistency in std::getline behavior between libc++ and libstdc++ (using clang3.3). The program opens the file testfile, reads it until eof, then clears the error bits using ifstream::clear and tries to read from the same filehandle again to see if new data was appended to the file. #include <fstream> #include <iostream> #include <unistd.h> using namespace std; int main() { ifstream* file = new ifstream("testfile"); if ( ! file->is_open() ) { cout << "testfile does not exist" << endl; return -1; } while ( 1 ) { file->clear(); // remove end of file evil

What does libstdc++'s std::vector<bool>::data do?

▼魔方 西西 提交于 2019-12-05 10:48:26
According to the standard, std::vector<bool> has no member function data() . However, the following snippet compiles fine with the latest GCC with libstdc++: #include <vector> int main () { std::vector<bool> v; v.data(); } If we try to use the result, it turns out the return type is void . Is this some gcc extension or a bug? If the former is true, what does it do? My /usr/include/c++/4.8/bits/stl_bvector.h has: // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 464. Suggestion for new member functions in standard containers. // N.B. DR 464 says nothing about vector<bool> but we need something // here due

Clang reject type_info as incomplete although <typeinfo> is included

我的未来我决定 提交于 2019-12-05 08:07:13
I'm lost as to why Clang rejects the following code: #include <typeinfo> #include <exception> const char* get_name( const std::exception_ptr eptr ) { return eptr.__cxa_exception_type()->name(); } int main() {} It OK with GCC, but Clang complains about type_info being an incomplete type: $ g++-4.7 -std=c++0x -O3 -Wall -Wextra t.cc -o t $ clang++-3.2 -std=c++0x -O3 -Wall -Wextra t.cc -o t t.cc:6:37: error: member access into incomplete type 'const class type_info' return eptr.__cxa_exception_type()->name(); ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/exception_ptr

The program cannot find correct version of glibc/libstdc++, although it was statically linked

不羁的心 提交于 2019-12-05 07:50:48
I am trying to link my program statically with glibc, because version of the glibc on the target machine is pretty much unpredictable. I used linker flags -static-libgcc and -static-libstdc++ and it worked fine. The executable is big, but I can live with it. Unfortunately, when I run my executable on the target machine (it is named 'mytest' in the example below) I get the following error: ./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by libboost_log.so.1.53.0) ./mytest: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by libboost_log

“the procedure entry point _ZNSt8_detail15_List_node_base7_M_hookEPS0_ could not be located in the dynamic link library libstdc -6.dll.”

二次信任 提交于 2019-12-05 07:49:28
have a small problem. I have c++ code, it's linking to some libraries. I have previously (original)exe from the source code and that runs perfectly on first machine. And there is second machine, where I work on the source code, change it, etc. On the second machine, the build of that source code works fine, bud when I copy the second.exe and try tu run it on the first machine it displays error message "the procedure entry point _ZNSt8_detail15_List_node_base7_M_hookEPS0_ could not be located in the dynamic link library libstdc++-6.dll." One thing, second.exe is copied in the same folder as

Getting GCC in C++11 mode to work on FreeBSD

不问归期 提交于 2019-12-05 06:13:38
How do I get a working GCC-based C++11 setup on FreeBSD 10? It seems that the standard library that comes with recent GCC versions on FreeBSD is broken. I've installed the port gcc49 and then try to compile this: #include <string> int main() { auto str = std::to_string(42); str = std::to_string(42ull); str = std::to_string(4.2); str.clear(); return 0; } This gives me an error: g++49 -v -std=c++11 foo.cc Using built-in specs. COLLECT_GCC=g++49 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc49/gcc/x86_64-portbld-freebsd10.0/4.9.2/lto-wrapper Target: x86_64-portbld-freebsd10.0 Configured with: ./..

Is libstdc++ support for std::unordered_map incomplete?

非 Y 不嫁゛ 提交于 2019-12-05 05:34:43
Related to this question on CodeReview, I tried to use std::unordered_map with a custom allocator but apparently this does not work with gcc/clang and libstdc++. The error can be generated from initializing an empty hash map with a std::allocator #include <unordered_map> int main() { typedef std::allocator<std::pair<const int, int>> A; typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A> H; auto h = H{A()}; // ERROR, cannot find constructor H::H(const A&) } Live Example . Question : is libstdc++ support for constructing std::unordered_map with a single allocator as