g++

segfault during __cxa_allocate_exception in SWIG wrapped library

ぃ、小莉子 提交于 2019-12-20 18:09:29
问题 While developing a SWIG wrapped C++ library for Ruby, we came across an unexplained crash during exception handling inside the C++ code. I'm not sure of the specific circumstances to recreate the issue, but it happened first during a call to std::uncaught_exception , then after a some code changes, moved to __cxa_allocate_exception during exception construction. Neither GDB nor valgrind provided any insight into the cause of the crash. I've found several references to similar problems,

cc1plus: error: include: Value too large for defined data type when compiling with g++

送分小仙女□ 提交于 2019-12-20 17:41:24
问题 I am making a project that should compile on Windows and Linux. I have made the project in Visual Studio and then made a makefile for linux. I created all the files in Windows with VS. It compiles and runs perfectly in VS but when I run the makefile and it runs g++ I get $ g++ -c -I include -o obj/Linux_x86/Server.obj src/Server.cpp cc1plus: error: include: Value too large for defined data type cc1plus: error: src/Server.cpp: Value too large for defined data type The code is nothing more than

How to check if compiled code uses SSE and AVX instructions?

泪湿孤枕 提交于 2019-12-20 12:56:11
问题 I wrote some code to do a bunch of math, and it needs to go fast, so I need it to use SSE and AVX instructions. I'm compiling it using g++ with the flags -O3 and -march=native , so I think it's using SSE and AVX instructions, but I'm not sure. Most of my code looks something like the following: for(int i = 0;i<size;i++){ a[i] = b[i] * c[i]; } Is there any way I can tell if my code (after compilation) uses SSE and AVX instructions? I think I could look at the assembly to see, but I don't know

How to check if compiled code uses SSE and AVX instructions?

牧云@^-^@ 提交于 2019-12-20 12:56:00
问题 I wrote some code to do a bunch of math, and it needs to go fast, so I need it to use SSE and AVX instructions. I'm compiling it using g++ with the flags -O3 and -march=native , so I think it's using SSE and AVX instructions, but I'm not sure. Most of my code looks something like the following: for(int i = 0;i<size;i++){ a[i] = b[i] * c[i]; } Is there any way I can tell if my code (after compilation) uses SSE and AVX instructions? I think I could look at the assembly to see, but I don't know

Can CMake use g++ to compile C files?

▼魔方 西西 提交于 2019-12-20 12:41:07
问题 I have worked on a project where I was using g++ to compile C code in files that end in .c. The reason is that I'm told that g++ has better warning messages. I am switching the build process for this project to use CMake. I found that initially CMake wanted to use gcc to compile C files. This failed because of things like declaring variables at use time. So I tried to use g++ to compile C files by using the setting set(CMAKE_C_COMPILER_INIT g++) in the CMakeLists.txt file. But this results in

playing with GCC 4.6 on windows

℡╲_俬逩灬. 提交于 2019-12-20 11:58:07
问题 I am very pleased to find out that GCC 4.6 supports the range-based for loop. I found an experimental release of MinGW 4.6 on xvidvideo.ru, is that a well-known, reliable website? What other options do I have (besides compiling myself from source code)? 回答1: I'm not really familiar with the site you linked as it's in Russian. The only other place I've found that offers current snapshots of GCC's build is from Equation Solution. I downloaded gcc4.5.1 from there and it's been working fairly

“warning: use of old-style cast” in g++ [duplicate]

会有一股神秘感。 提交于 2019-12-20 10:18:42
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: When should static_cast, dynamic_cast and reinterpret_cast be used? With this C++ code, char* a = (char*) b; I got warning warning: use of old-style cast . What would be the new-style cast? 回答1: reinterpret_cast , static_cast , dynamic_cast and const_cast are the c++ cast alternatives. const_cast to remove const/volatile from a const variable. dynamic_cast to perform runtime validity checks when casting in

g++ __static_initialization_and_destruction_0(int, int) - what is it

大憨熊 提交于 2019-12-20 09:55:46
问题 After compiling of c++ file (with global static object) I get in nm output this function: 00000000 t _Z41__static_initialization_and_destruction_0ii __static_initialization_and_destruction_0(int, int) /* after c++filt */ What is it? It will call __cxa_atexit() Can I disable generation of this function (and calling a __cxa_atexit() ) and put all constructor and destructor calls to .ctors and .dtors sections? 回答1: This doc file seems to tell ya all you'd wanna know about those functions: http:/

Rcpp Rtools installed but error message g++ not found

a 夏天 提交于 2019-12-20 09:20:58
问题 I have consulted existing entries on SO related to my specific issue, but still could not resolve it. I am trying to do this with my machine at work, where I have limited admin rights, but I can run Rtools.exe, so I installed it. My setup for R is: platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 version.string R version 3.3.0 (2016-05-03) I am RStudion Version 0.99.902. I installed Rtools version 3.3.0.1959. All of R, Rstudio, and Rtools are installed in C:/WORK/,

How can I improve performance via a high-level approach when implementing long equations in C++

青春壹個敷衍的年華 提交于 2019-12-20 08:33:04
问题 I am developing some engineering simulations. This involves implementing some long equations such as this equation to calculate stress in a rubber like material: T = ( mu * ( pow(l1 * pow(l1 * l2 * l3, -0.1e1 / 0.3e1), a) * a * ( pow(l1 * l2 * l3, -0.1e1 / 0.3e1) - l1 * l2 * l3 * pow(l1 * l2 * l3, -0.4e1 / 0.3e1) / 0.3e1 ) * pow(l1 * l2 * l3, 0.1e1 / 0.3e1) / l1 - pow(l2 * pow(l1 * l2 * l3, -0.1e1 / 0.3e1), a) * a / l1 / 0.3e1 - pow(l3 * pow(l1 * l2 * l3, -0.1e1 / 0.3e1), a) * a / l1 / 0.3e1