g++

Is there a g++ equivalent to Visual Studio's __declspec(novtable)?

梦想的初衷 提交于 2019-12-18 04:39:09
问题 Is there a g++ equivalent to Visual Studio's __declspec(novtable) argument? Basically, in a pure virtual base class the __declspec(novtable) argument can be used to suppress the creation of a vtable for the base class as well as vtable initialization/deinitialization code in the contstructor/destructor respectively. E.g., class __declspec(novtable) PureVirtualBaseClass { public: PureVirtualBaseClass(){} virtual ~PureVirtualBaseClass() = 0; }; See Paul DiLascia's article for more info. Also

“g++” is not recognized as an internal or external command, MinGW

和自甴很熟 提交于 2019-12-18 04:35:17
问题 On my computer I have Windows 7 x86. I installed MinGW, I wrote the path but when I go in cmd.exe and write g++ -v it says: "g++" is not recognized as an internal or external command. But when I write the make -v command it recognizes it. I need this for school, I work in Eclipse, I even installed the latest java(I saw it must be installed). 回答1: Seeing that the make command works fine, I think you forgot to mark the mingw-gcc-g++ package in the MinGW Installation Manager. Run the MinGW

How to get POSIX strerror_r instead of GNU version?

左心房为你撑大大i 提交于 2019-12-18 04:07:39
问题 How do I get the POSIX strerror_r instead of GNU version? I'm compiling with g++ on Ubuntu 8.04 with glibc version 2.7 ( based on what's in ). Edit On the above man page it says: Feature Test Macro Requirements for glibc (see feature_test_macros(7)): The XSI-compliant version of strerror_r() is provided if: (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE Otherwise, the GNU-specific version is provided. It then says in feature_test_macros(7): If no feature test macros are

Is there a (Linux) g++ equivalent to the /fp:precise and /fp:fast flags used in Visual Studio?

混江龙づ霸主 提交于 2019-12-18 04:02:57
问题 Background: Many years ago, I inherited a codebase that was using the Visual Studio (VC++) flag '/fp:fast' to produce faster code in a particular calculation-heavy library. Unfortunately, '/fp:fast' produced results that were slightly different to the same library under a different compiler (Borland C++). As we needed to produce exactly the same results, I switched to '/fp:precise', which worked fine, and everything has been peachy ever since. However, now I'm compiling the same library with

Boost.Thread Linking - boost_thread vs. boost_thread-mt

ぐ巨炮叔叔 提交于 2019-12-18 03:54:56
问题 It's not clear to me what linking options exist for the Boost.Thread 1.34.1 library. I'm on Ubuntu 8.04 and I've found that when using either boost_thread or boost_thread-mt during linking both compile and run, but I don't see any documentation on these or any other linking options in above link. What Boost.Thread linking options are available and what do they mean? 回答1: Well... The first amusing thing is that the -mt modifier in the name is to indicate the library is Ok for multithreading.

g++, static initialization and -nostdlib

蓝咒 提交于 2019-12-18 02:42:40
问题 Compiling / linking with -nostdlib seems to prevent static initialization, even if I add my own crti.s and crtn.s with .init / .fini sections. Are there workarounds to make g++ generate static initialization code that is inserted in .init or that I can call manually? This is what I tried: g++ -o test.o -c -fno-use-cxa-atexit test.cc # has _start (entry point) # that calls _init and _main as -o crti.o crti.s # has _init in section .init as -o crtn.o crtn.s g++ -o test ./crti.o test.o

g++ template parameter error

倾然丶 夕夏残阳落幕 提交于 2019-12-17 23:17:32
问题 I have GetContainer() function as follows. template<typename I,typename T,typename Container> Container& ObjCollection<I,T,Container>::GetContainer() { return mContainer; } When I use this method as follows template<typename I,typename T> T& DynamicObjCollection<I,T>::Insert(T& t) { GetContainer().insert(&t); return t; } I got errors. error: there are no arguments to ‘GetContainer’ that depend on a template parameter, so a declaration of ‘GetContainer’ must be available error: (if you use ‘

Why does g++ look in LIBRARY_PATH/../lib64 and where is this documented?

橙三吉。 提交于 2019-12-17 23:03:46
问题 My LIBRARY_PATH environment variable has a custom directory in it: /cs/public/lib/pkg/opencv/lib . But, when I use g++ --print-search-dirs , I get this instead: libraries: = /cs/public/lib/pkg/opencv/lib/x86_64-suse-linux/4.6/: /cs/public/lib/pkg/opencv/lib/../lib64/: /usr/lib64/gcc/x86_64-suse-linux/4.6/: /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.6/: /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/lib/../lib64/: /usr/lib64

How to link host code with a static CUDA library after separable compilation?

淺唱寂寞╮ 提交于 2019-12-17 22:37:27
问题 Alright, I have a really troubling CUDA 5.0 question about how to link things properly. I'd be really grateful for any assistance! Using the separable compilation features of CUDA 5.0, I generated a static library (*.a). This nicely links with other *.cu files when run through nvcc, I have done this many times. I'd now like to take a *.cpp file and link it against the host code in this static library using g++ or whatever, but not nvcc. If I attempt this, I get compiler errors like undefined

Deduction guide and variadic templates

主宰稳场 提交于 2019-12-17 20:45:55
问题 Consider the following code: #include <tuple> #include <iostream> template <class T> struct custom_wrapper { template <class Arg> custom_wrapper(Arg arg): data(arg) {} T data; }; template <class Arg> custom_wrapper(Arg arg) -> custom_wrapper<Arg>; template <class... T> struct custom_tuple { template <class... Args> custom_tuple(Args... args): data(args...) {} std::tuple<T...> data; }; template <class... Args> custom_tuple(Args... args) -> custom_tuple<Args...>; int main(int argc, char* argv[]