c++-standard-library

Why are standard library function names different between Windows and Linux?

寵の児 提交于 2020-01-03 09:55:14
问题 I am porting a Windows library to Android (with the GNU Standard C++ Library option, libstdc++-v3) and there seem to be numerous naming differences between the VC and GNU libraries, e.g.: _stricmp is called strcasecmp instead _unlink is called unlink _scalb is called scalbn _finite is called isfinite _isnan is called isnan _itoa and itoa do not seem to exist in GNU C++ atoi does exist, but not atoi64 The documentation of both VC and GNU libraries implies that they implement "ISO" C++, for

Why are standard library function names different between Windows and Linux?

断了今生、忘了曾经 提交于 2020-01-03 09:52:08
问题 I am porting a Windows library to Android (with the GNU Standard C++ Library option, libstdc++-v3) and there seem to be numerous naming differences between the VC and GNU libraries, e.g.: _stricmp is called strcasecmp instead _unlink is called unlink _scalb is called scalbn _finite is called isfinite _isnan is called isnan _itoa and itoa do not seem to exist in GNU C++ atoi does exist, but not atoi64 The documentation of both VC and GNU libraries implies that they implement "ISO" C++, for

Link errors compiling a mixed objective-C/C++ project with C++11 support in xcode 4.5.2

左心房为你撑大大i 提交于 2020-01-03 01:55:11
问题 I am trying to compile a workspace of 3 projects with C++11 support. This set of projects has successfully compiled and linked using LLVM compiler defaults. In addition, the c++ code has previously compiled on a number of compilers including g++, llvm, msvc, sun, irix etc so it is very clean code. Under the c++ language dialect section of the workspace build settings there are 3 line items: c language dialect c++ language dialect c++ standard library Using the settings: c language dialect:

Error LNK2019: unresolved external symbol “toString(int)”

谁说胖子不能爱 提交于 2020-01-02 04:11:15
问题 Environment: Windows XP. Visual Studios 2010. Language - C++. I have run into the following link error & have run out of ideas how to fix this problem. I have a project (CnD Device) which links to 2 projects (Messages & Carbon) controlled by my group. I have tried to search for project properties between the 3 projects enter tcp_driver.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toString(int)"

Error LNK2019: unresolved external symbol “toString(int)”

好久不见. 提交于 2020-01-02 04:11:09
问题 Environment: Windows XP. Visual Studios 2010. Language - C++. I have run into the following link error & have run out of ideas how to fix this problem. I have a project (CnD Device) which links to 2 projects (Messages & Carbon) controlled by my group. I have tried to search for project properties between the 3 projects enter tcp_driver.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toString(int)"

Optimizing a comparison over array elements with two conditions; C++ abstraction mechanisms?

孤街醉人 提交于 2020-01-01 19:28:12
问题 My question is a follow-up to How to make this code faster (learning best practices)?, which has been put on hold (bummer). The problem is to optimize a loop over an array with floats which are tested for whether they lie within a given interval. Indices of matching elements in the array are to be stored in a provided result array. The test includes two conditions (smaller than the upper threshold and bigger than the lower one). The obvious code for the test is if( elem <= upper && elem >=

Does redefining a function from the standard library violate the one-definition rule?

99封情书 提交于 2020-01-01 12:08:21
问题 #include <cmath> double log(double) {return 1.0;} int main() { log(1.0); } Suppose the function log() in <cmath> is declared in global namespace (this is unspecified in fact, and we just make this assumption), then it refers to the same function as the log() function we defined. So does this code violate the one-definition rule (see here, since no diagnostic required, this code may compile in some compiler and we cannot assert if it is correct)? Note : After recent edits, this is not a

Is it permissible for standard library implementation to have class definition that is different from the C++ standard?

我是研究僧i 提交于 2020-01-01 08:21:53
问题 The following code successfully compiled with clang and MSVC but fail to compile in GCC 6.1.0. #include <memory> template<typename R, typename T, typename... Args> T* test(R(T::*)(Args...) const) { return nullptr; } int main() { using T = std::shared_ptr<int>; T* p = test(&T::get); } with the following error message prog.cc: In function 'int main()': prog.cc:13:16: error: invalid conversion from 'std::__shared_ptr<int, (__gnu_cxx::_Lock_policy)2u>*' to 'T* {aka std::shared_ptr<int>*}' [

Is it permissible for standard library implementation to have class definition that is different from the C++ standard?

若如初见. 提交于 2020-01-01 08:21:45
问题 The following code successfully compiled with clang and MSVC but fail to compile in GCC 6.1.0. #include <memory> template<typename R, typename T, typename... Args> T* test(R(T::*)(Args...) const) { return nullptr; } int main() { using T = std::shared_ptr<int>; T* p = test(&T::get); } with the following error message prog.cc: In function 'int main()': prog.cc:13:16: error: invalid conversion from 'std::__shared_ptr<int, (__gnu_cxx::_Lock_policy)2u>*' to 'T* {aka std::shared_ptr<int>*}' [

Where are the headers of the C++ standard library

跟風遠走 提交于 2019-12-31 10:31:51
问题 I wonder where on my file system I find the headers of the C++ Standard library. In particular I am looking for the definition of the vector template. I searched in /usr/include/ and various subdirectories. I also tried 'locate vector.h' which brought up many implementations of vectors, but not the standard one. What am I missing? (The distribution is Gentoo) Background: I'm profiling a library that iterates over vector's most of the time and gprof shows that most of the time is spent in std: