g++

Cmake doesn't honour -D CMAKE_CXX_COMPILER=g++

谁说我不能喝 提交于 2019-12-30 08:03:20
问题 I'm trying to force cmake to build my cpp code with g++, as by default it uses clang instead. So I use: cmake -D CMAKE_CXX_COMPILER=g++ ../src/CMakeLists.txt after which cmake checks for gcc and g++ (with success), but nonetheless make VERBOSE=1 yields /usr/bin/c++ -o CMakeFiles/trial_cpp.dir/trial.cpp.o -c "/Users/Kuba/Code/Sketchpad/Trial project/src/trial.cpp" Linking CXX executable trial_cpp /opt/etlocal/bin/cmake -E cmake_link_script CMakeFiles/trial_cpp.dir/link.txt --verbose=1 /usr/bin

Cmake doesn't honour -D CMAKE_CXX_COMPILER=g++

匆匆过客 提交于 2019-12-30 08:03:05
问题 I'm trying to force cmake to build my cpp code with g++, as by default it uses clang instead. So I use: cmake -D CMAKE_CXX_COMPILER=g++ ../src/CMakeLists.txt after which cmake checks for gcc and g++ (with success), but nonetheless make VERBOSE=1 yields /usr/bin/c++ -o CMakeFiles/trial_cpp.dir/trial.cpp.o -c "/Users/Kuba/Code/Sketchpad/Trial project/src/trial.cpp" Linking CXX executable trial_cpp /opt/etlocal/bin/cmake -E cmake_link_script CMakeFiles/trial_cpp.dir/link.txt --verbose=1 /usr/bin

Compile 64-bit binary with MinGW (Dev-C++)

风格不统一 提交于 2019-12-30 05:46:46
问题 It is probably a stupid question but i was searching for the answer from about 3h. ¿How to compile 64-bit binary with (Dev-C++) MinGW? I have readed that MinGW support 64bits by default, but i am unable to active this option. I have tryed "-m64" but it say: "sorry, unimplemented: 64-bit mode not compiled in" I am working on Dev-C++ on Windows-7 I know how to do it on MSVC++, but I don't want MSVC++ (cause of ethical issues) What i am trying to compile, just for testing purpose: #include

How does scoped_lock avoid emitting an “unused variable” warning?

╄→гoц情女王★ 提交于 2019-12-30 03:55:09
问题 boost::mutex::scoped_lock is a handy RAII wrapper around locking a mutex. I use a similar technique for something else: a RAII wrapper around asking a data interface to detach from/re-attach to a serial device. What I can't figure out, though, is why in the code below only my object mst — whose instantiation and destruction do have side effects — causes g++ to emit an "unused variable" warning error whereas l manages to remain silent. Do you know? Can you tell me? [generic@sentinel ~]$ cat

undefined reference to `boost::program_options::options_description::m_default_line_length'

徘徊边缘 提交于 2019-12-30 03:41:05
问题 I am trying to compile a code and I get the error undefined reference to boost::program_options::options_description::m_default_line_length I use g++ in Ubuntu 12.04. Although I have done some C++ programming I am new to the Linux development environment (used only IDEs previously). So I did a basic search for this trouble, and found about some linking issues. I didn't quite understand them as I am a newbie. Reading some of those solutions confused me further. My boost library folder is in

Getting mingw-get to install correctly - mingw/msys path missing plus more!

∥☆過路亽.° 提交于 2019-12-30 03:12:25
问题 I'm running windows XP. I have been following this tutorial and so downloading mingw-get-inst here. I've done this a couple times and the last time I checked boes to install EVERYTHING including, but not limited to, gcc, g++, MSYS and the MinGW Compiling Suite. I told it to make a program menu shortcut, too. I believe I have correctly added MinGW/bin to the Environment Settings' Path . So I have the shortcut to the MSYS shell now. It goes to C:\MinGW\msys\1.0\msys.bat, but the whole msys

How do I detect if my code is being compiled with -fno-exceptions?

旧街凉风 提交于 2019-12-30 03:06:26
问题 I'm writing a C++ library and I would like to make my API throw exceptions for invalid parameters, but rely on asserts instead when the code is compiled with -fno-exceptions . Is there a way to detect at compile-time if I'm allowed to use exception handling? Note that I'm writing a header-only library, so I don't have a configure phase and I don't have access to the build system to simply define a macro on the command line (and I don't want to add burden to the user). Since the Standard doesn

Scope resolution operator

我的梦境 提交于 2019-12-30 02:33:06
问题 I accidentally happened to find this in one of the source codes I was looking at. So, I'm giving a similar smaller example here. In the file test.h : #include<iostream> class test{ int i; public: test(){} //More functions here }; In the file test.cpp : #include "test.h" int main() { test test1; test::test test2; test::test::test test3; return 0; } First of all, is there a reason to declare test2 that way? Secondly, this code compiles just fine in g++ version 4.4.3 and lower versions. Is there

g++ undefined reference although symbol is present in *.so file

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 01:34:07
问题 I found a number of similar questions (e.g. this, that or this), but none of them helped me solve my problem. I have a *.so file (from the core of gnss-sdr) that, as indicated by: $nm libgnss_system_parameters_dyn.so | c++filt |grep Gps_Eph contains the symbol Gps_Ephemeris::Gps_Ephemeris() , which is supposed to be a constructor. I've written some minimal code: #include <iostream> #include <core/system_parameters/gps_ephemeris.h> int main(int argc,const char* argv[]) { Gps_Ephemeris ge;

Will adding the -rdynamic linker option to gcc/g++ impact performance?

拥有回忆 提交于 2019-12-30 00:03:04
问题 I want to get the stack trace when the application crashes. I understand that the -rdynamic option enables to get the complete stack trace with the function names. But I'm concerned if there will be any impact on the performance of my application. 回答1: Yes, there is, although it is very specific and normally not a cause of concern. The -rdynamic option instructs the linker to add symbols to the symbol tables that are not normally needed at run time. It means there are more, possibly many more