g++

‘stoi’ was not declared in this scope [duplicate]

两盒软妹~` 提交于 2020-01-13 11:02:50
问题 This question already has answers here : cygwin g++ std::stoi "error: ‘stoi’ is not a member of ‘std (4 answers) Closed 4 years ago . So this error have been addressed several times, but no answers helped me. I'm using Notepad++ and Cygwin on windows 10. My code is as follows and it's from Derek Banas's 1 hour C++ tutorial: #include <iostream> #include <vector> #include <string> #include <fstream> #include <cstdlib> #include <sstream> //#include <stdlib.h> using namespace std; int main(){

‘stoi’ was not declared in this scope [duplicate]

我只是一个虾纸丫 提交于 2020-01-13 11:02:08
问题 This question already has answers here : cygwin g++ std::stoi "error: ‘stoi’ is not a member of ‘std (4 answers) Closed 4 years ago . So this error have been addressed several times, but no answers helped me. I'm using Notepad++ and Cygwin on windows 10. My code is as follows and it's from Derek Banas's 1 hour C++ tutorial: #include <iostream> #include <vector> #include <string> #include <fstream> #include <cstdlib> #include <sstream> //#include <stdlib.h> using namespace std; int main(){

Linux executable can't find shared library in same folder

喜夏-厌秋 提交于 2020-01-13 10:29:26
问题 I am relatively new to Linux development, having been using Windows for a while now. Anyway, I am compiling a C++ game using g++ on both Windows and Linux (using mingw32 when needed), and am linking against SDL2 and SDL2_mixer. On Windows, one would only need to put the DLL files in the same folder as the executable and everything would run fine. On Linux however, although the code compiled just fine with not even a single warning, I get this at runtime : ./nKaruga: error while loading shared

g++ on MacOSX doesn't work with -arch ppc64

跟風遠走 提交于 2020-01-13 10:29:12
问题 I am trying to build a Universal binary on MacOSX with g++. However, it doesn't really work. I have tried with this simple dummy code: #include <iostream> using namespace std; int main() { cout << "Hello" << endl; } This works fine: % g++ test.cpp -arch i386 -arch ppc -arch x86_64 -o test % file test test: Mach-O universal binary with 3 architectures test (for architecture i386): Mach-O executable i386 test (for architecture ppc7400): Mach-O executable ppc test (for architecture x86_64): Mach

Does while loop have two Arguments?

我只是一个虾纸丫 提交于 2020-01-13 06:12:35
问题 My ma'am gave me one question to solve. To predict the output of the following code. #include <stdio.h> int main() { int i = 0, j = 0; printf("Output is : "); while (i < 5, j < 10) // Doubt: how does while accept 2 arguments?? and how it works?? { i++; j++; } printf("%d, %d\n", i, j); } I thought it was a syntax error. But when I tried to run, it gave me output. Output is : 10, 10 But How? Can anyone explain? But if I remove the first printf statement printf("Output is : "); and run it, my

OpenCV 2.4.2: Undefined References

佐手、 提交于 2020-01-13 05:59:06
问题 libcv-dev install 10.04 Any ideas as to where the following might be defined? ahcarpenter@ahcarpenter-laptop:~$ g++ objectmarker.o -o objectmarker objectmarker.o: In function `on_mouse(int, int, int, int, void*)': objectmarker.cpp:(.text+0x12f): undefined reference to `cvCloneImage' objectmarker.cpp:(.text+0x1d1): undefined reference to `cvRectangle' objectmarker.cpp:(.text+0x1ea): undefined reference to `cvShowImage' objectmarker.cpp:(.text+0x1f4): undefined reference to `cvReleaseImage'

EGL linker errors

蓝咒 提交于 2020-01-13 03:37:34
问题 I'm trying to link a really simple GLES2 & EGL program using g++ 4.9.1, on a Ubuntu Trusty system. I'm using the mesa libraries. I'm getting linker errors for EGL functions: test.cpp:(.text+0x342): undefined reference to `eglGetDisplay' test.cpp:(.text+0x389): undefined reference to `eglInitialize' test.cpp:(.text+0x40f): undefined reference to `eglCreateContext' test.cpp:(.text+0x458): undefined reference to `eglCreatePbufferSurface' test.cpp:(.text+0x49e): undefined reference to

CMAKE_COMPILER_IS_GNUCXX and CMAKE_CXX_COMPILER_ID are empty

强颜欢笑 提交于 2020-01-12 07:41:11
问题 I am currently playing around with CMake and want to detect the compiler and the compiler version. My current CMakeLists.txt looks as follows: cmake_minimum_required (VERSION 2.6) set (PROJECT "a_tour_of_c++") set (GNUCXX_MINIMUM_VERSION "4.8") set (CXX_STANDARD "c++11") message ("${CMAKE_CXX_COMPILER}") # C:/dev/MinGW/bin/g++.exe message ("${CMAKE_CXX_COMPILER_ID}") # EMPTY message ("${CMAKE_COMPILER_IS_GNUCXX}") # EMPTY if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_CXX_COMPILER_VERSION VERSION

g++ curly quotes displayed incorrectly in console and “Problems” list

主宰稳场 提交于 2020-01-12 07:38:09
问题 Recently, I switched from Visual Studio to Eclipse CDT. I've set it up beautifully such that the G++ compiler from my Cygwin installation can locate and compile my code without ado. There is a minor grievance, however. Each time G++ reports a warning or error, the curly single quotes ‘ and ’ appear as ‘ respectively ’ . It seems like a character encoding problem; G++ or Cygwin is spitting out a character encoding that either CDT or Eclipse doesn't like. This is only relevant Google result

Different results in Clang and GCC when casting to std::optional<T>

拟墨画扇 提交于 2020-01-12 06:26:10
问题 Given the following code: #include <iostream> #include <optional> struct foo { explicit operator std::optional<int>() { return std::optional<int>( 1 ); } explicit operator int() { return 0; } }; int main() { foo my_foo; std::optional<int> my_opt( my_foo ); std::cout << "value: " << my_opt.value() << std::endl; } gcc 7.2.0 writes value: 1 . MSVC 2017 (15.3) and clang 4.0.0 however write value: 0 . Which one is correct according to the C++ standard? 回答1: Since this is direct-initialization, we