Questions tagged [g++]

5

votes
1

answer
99

Views

Is gcc wrongly evaluating std::declval in this concept definition?

In this concept definition: #include template concept Invokable = requires(Func f) { { f(std::declval()...) } -> Ret; }; when instantiated like this: static_assert(Invokable); gcc-9.0.1 (trunk) dumps (well, the Standard Library implementation to be precise): $ g++ -O2 -std=c++2a -fconcepts -Wall -W...
YSC
1

votes
2

answer
36

Views

Error: could not convert '<brace-enclosed initializer list>()' from '<brace-enclosed initializer list>' to 'struct'

template class Vec { T data[S]; public: constexpr Vec(const T& s) : data{s} {} }; template class Mat { Vec data[Rows]; public: constexpr Mat(const T& s) : data{Vec(s)} {} }; int main() { constexpr Mat m{1.0}; return 0; } This code gives me the following error: source/main.cpp:24:25: error: could n...
David Bermejo
1

votes
2

answer
22

Views

How did Cygwin g++ resolve it?

I am puzzled how a mere g++ -o testpoco testpoco.cpp -lPocoFoundation was able to compile successfully in my Cygwin environment. The complete C++ code is below: #include int main (int argc, char *argv[]) { Poco::File f('/tmp/test.log'); if (f.exists()) { return 1; } return 0; } I installed the cygw...
typelogic
1

votes
1

answer
174

Views

How to install GCC/G++ 8 on CentOS

I'm used to install packages on Debian/Ubuntu distributions, but now I need to install gcc and g++ version 8.*. There is only version 4.* in CentOS repositories. What's the correct way to install them manually?
Eenoku
1

votes
1

answer
145

Views

Why does link_libraries(stdc++fs) work but not -lstdc++fs?

I was trying to compile a C++17 program on Ubuntu using CMake/g++ 8.1 which contained #include When I used this set(CMAKE_CXX_FLAGS '-lstdc++fs') I got a weird linker error undefined reference to `std::filesystem::__cxx11::recursive_directory_iterator::~recursive_directory_iterator()' This error al...
Vincent La
1

votes
1

answer
48

Views

How to keep assembly files with --save-temps when multiple targets use the same source file?

If I compile the C++ program /tmp/src/main.cc #include int main() { #ifdef demo1 std::cout
Erik Sjölund
1

votes
1

answer
50

Views

std::gcd does not compile in g++ 5.4.0 — 'gcd' is not a member of 'std'

Environment: Ubuntu 16.04 64 bit g++ version 5.4.0 This is the code: #include ... auto g = std::gcd(10, 4); ... I have turned on the -std=c++17 option in the compiling command: g++ -m64 -std=c++17 -c -g -w -MMD -MP -MF 'build/Debug/GNU-Linux/main.o.d' -o build/Debug/GNU-Linux/main.o main.cpp The...
user5280911
1

votes
3

answer
66

Views

Compiler errors with incorrect use of nullptr

I am trying the solution provided in this SO Q/ACompiler error while using shared_ptr with a pointer to a pointer and I am not able to use the solution provided in a proper way. I still get compilation errors on Ubuntu 18.04 with g++ version 7.3 Here is my minimum complete verifiable example to repr...
gansub
1

votes
0

answer
279

Views

C++/mingw-gcc-g++ string declaration error

I am using g++ to compile a very simple c++-program with g++ main.cpp -o main.exe My code: #include int main() { std::string a; return 0; } [Windows 10 | mingw-gcc-g++ 6.3.0-1] When I try to run the created main.exe, I get the exit code: 3221225785. gdb returns: (gdb) start Temporary breakpoint 2...
Gmork
1

votes
0

answer
343

Views

Use cygwin as the mex compiler in matlab

I have set cygwin as the mex compiler for MATLAB 2016b by setting the environment variable MW_MINGW64_LOC to be G:\cygwin64. I then tested some simple examples. The g++ in cygwin works fine as a compiler. However, when I call the compiled mexw64 function, matlab crashes and the error message is as f...
Hugo
1

votes
0

answer
510

Views

How do install gcc 4.4 and g++ 4.4 on Fedora 27

I have Fedora 27 and will compile a applicationh with gcc4.4 and g++4.4. But i can not install this version with yum or with update-alternatives Can you help me
jdeb
1

votes
0

answer
420

Views

g++: Will -fno-omit-frame-pointer be effective if specified before -O2 or -O3?

We have a complex hierarchical make file system where the 'CXXFLAGS' is appended in several places (several separate makefiles of individual libraries). There's one master file that seems to be getting included in every other make file. So I specified the '-fno-omit-frame-pointer' flag there. When I...
Krishna
1

votes
0

answer
58

Views

Can't get right link order out of Qt project file

I do have a test.cpp file that I know how to compile using g++ or Makefile g++ test.cpp -o test -std=c++11 -O3 -lGL -lGLU -lglut -ldrm I am trying to make a Qt project file for compile like below: TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt QMAKE_LFLAGS += -o3 -lGL -lGL...
AMCoded
1

votes
1

answer
108

Views

Easy way to get cmake default compiler

I am new to cmake. I have seen that doing export CXX=g++ tells cmake to use the g++ compiler for the .cpp files for instance. I also read that if we don't pass any compiler with CXX, it will search for a compiler with name cc, gcc, cl, bcc, xlc, clang (in that order). But if we don't export any com...
roi_saumon
1

votes
0

answer
271

Views

Cannot deploy the precompiled header (.gch)

Could you, please, help me with warning: pch.hpp.gch: not used because '__STDC_IEC_559__' not defined emerging when I am trying to deploy a gcc-generated precompiled header with boost headers? Here is my toy model. File pch.hpp: #include #include #include #include and its complementary pch.cpp #...
Oleksii Rudenko
1

votes
1

answer
32

Views

COTson linux installation

I'm new in linux, and i know that this should be a stupid question, but i didn't find anything over the internet, so i decide to ask it here: During the configuration of the COTson program using this line of code it gives me an error: CODE: ./configure --simnow_dir ../simnow-linux64-4.6.2pub ERROR :...
Fiorelo Odobashi
1

votes
0

answer
124

Views

Using devtools::document to compile Rcpp code that includes foreign package

I'm trying to develop an R package (named gpuUtils) that will import C++ code that makes use of RViennaCL for GPU utilization. I installed RViennaCL. Then, I followed Hadley's guidelines for package development and usage of C++ code, and created a C++ file with these lines: // [[Rcpp::depends(RcppAr...
dan
1

votes
2

answer
348

Views

Does example of Erwin Unruh work today?

Here is the example from Erwin Unruh famous for using C++ template meta-programming to produce the prime number in the compiler error message as follow. // Erwin Unruh, untitled program, // ANSI X3J16-94-0075/ISO WG21-462, 1994. template struct D { D(void *); operator int(); }; template struct is...
ar2015
1

votes
0

answer
74

Views

C++ - Can't compile functions of <cstdio> at ubuntu17.10 with g++ (Ubuntu 4.8.5-4ubuntu6) 4.8.5

I am new to this forum and have the following question. I recently installed ubuntu 17.10 (artful). My compiler is g++ (Ubuntu 4.8.5-4ubuntu6 (output of g++ --version). Unfortunately i cannot chose a newer compiler version, due to a specific framework i use. I wrote the following minimal example:...
Max Graf
1

votes
0

answer
254

Views

fatal error: No such file or directory while installing R packages

Anyone seen this error while installing the R packages in AWS * installing *source* package ‘kernlab’ ... ** package ‘kernlab’ successfully unpacked and MD5 sums checked ** libs g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/include -fpic -O2 -g -pipe - Wall -Wp,-D_FORTIFY_SOURCE=2 -fexcepti...
Arun
1

votes
1

answer
412

Views

Boost Program Options : linking error

I am having errors while compiling my C++ code on the server. So on this particular server the standard g++ installed is version 4.4.6, which I cannot use for my program since I need -std=c++14. So I use a different version, which is installed in the home directory of another user, which is a versio...
Marius Küpper
1

votes
0

answer
98

Views

Fail compilation with FFTW3 library with g++-6.4.0 under cygwin

I have the following code from sigpack website #include 'sigpack.h' using namespace arma; using namespace sp; int main() { int N = 45191; // Large prime number FFTW ss(N,FFTW_ESTIMATE); vec x(N); cx_vec Sxx(N); vec P(N); clock_t tic; for (int n = 1; n < 5; n++) { x.randn(); tic = clock(); Sxx =...
IBUD FAMILY TRIP
1

votes
1

answer
40

Views

Build issue with Crypto++ 5.6.5 using Linux command line g++

I'm trying to run this example utilizing Crypto++library, and I downloaded/stored Crypto++ in /home/thirdparty/cryptopp. However, when run the following command line: g++ -I/home/thirdParty channelSwitch.cpp -L/home/thirParty -o test-cs.exe Can someone help check what is the problem? /tmp/ccPnCG56.o...
Sarah
1

votes
0

answer
89

Views

Feature flag for `std::invoke_result`

Over at gnu.org, a list of features flags are given for various C++17 features is provided. However, I cannot find a feature flag for support of std::invoke_result. How can I tell if a particular version of g++ supports std::invoke_result? Note: I would also like to find flags to determine support f...
user14717
1

votes
1

answer
216

Views

Can't install Vowpal Wabbit Python Wrapper Ubuntu 16.04

I'm having trouble with installation of the Vowpal Wabbit Python Wrapper: $ pip3 install vowpalwabbit Error: lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 4.1 error message Note that: libboost-program-options-dev, zlib1g-dev, libboost-python-dev are instal...
Sergijjj
1

votes
0

answer
53

Views

Linkin two shared library with same symbol name but different symbol type

I want to link two shared libraries that both two libraries have same symbol name but different symbol type. For example, there are liba.so and libb.so libraries that consist of two files a.c/b.c and b_wrapper.c/a_wrapper.c a.c __thread int var; a_wrapper.cpp extern __thread int var; liba.so $ gcc -...
Eva
1

votes
0

answer
45

Views

gcc vs MSVC C++: pushing a queue of unique_ptrs into a vector

It's a well known fact that if you want to push something into std::vector, then you have to move ownership of that pointer to Foo to the vector: std::vector vector; std::unique_ptr item; vector.push_back(item); // Fails, as copy constructor is deleted for unique ptr vector.push_back(std::move(item)...
GreyCat
1

votes
0

answer
249

Views

Cygwin g++ --unresolved-symbols=ignore-all

I have a simple proof case file, which is called main.c void bar(void); void foo(void) { bar(); } int main(void) { return 0; } As you can see there is no definition for bar() My goal is to compile this on windows using cygwin's gcc. I have figured out that I could use the following linker option:...
Mate Rigo
1

votes
0

answer
99

Views

Automated cross compiling and linking static OpenCV libraries

I built OpenCV with the following on ubuntu: cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D BUILD_SHARED_LIBS=OFF \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D BUILD_opencv_python2=OFF \ -D BUILD_opencv_python3=OFF \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D INSTALL_C_EXAMPLES=OFF \ -D BUILD_JAVA=OFF \ -D BUILD_TESTS...
Joel
1

votes
0

answer
80

Views

eclipse CDT g++ unable to link minimodem c code in c++ project

I am trying to compile a c++ project in Eclipse CDT with third party C project (minimodem https://github.com/kamalmostafa/minimodem), Currently my project simply contains a few cpp files and folder inside the source folder with C files. I have included c headers the main.cpp c files using extern 'C...
user482963
1

votes
0

answer
37

Views

profile-generate won't generate gcda file

I have simplified my source like the following : void *thread1(void *param) { pthread_detach(pthread_self()); while(1) { sleep( 3 ) ; printf('hello world in thread1 \n'); } //while return NULL ; } //thread1 int main() { pthread_t tid ; pthread_create(&tid , NULL, thread1, (void*)3); while(1) { sleep...
barfatchen
1

votes
0

answer
150

Views

Cannot get Makefile to use g++ instead of clang++ on Mac OS

I'm trying to compile a C++ library on Mac OS which compiles on Linux. (This is done via installing an R package via a Makevars file, see: https://cran.r-project.org/doc/manuals/r-release/R-exts.html) On Linux, I see the following when I do make: g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I../i...
ShanZhengYang
1

votes
1

answer
63

Views

Performance of switch within a loop

We have a map of message types to a list of messages. Given a performance critical piece of code such as this: struct row_t { int message_type; //0,1,2,3,4,5 }; map message_map; for (auto x : message_map) { int message_type = x.first; vector message_rows = x.second; for (row_t row : message_rows) {...
1

votes
0

answer
61

Views

Makefile for a gtkmm compilation

I have an app which uses Gtkmm for UI and I can compile it with a command line (saved in a script), and have read/tried to use a Makefile for it. See below: SRCDIR = src BINDIR = bin OBJECTS = $(SRCDIR)/Dependency_1.o $(SRCDIR)/Dependencies_2.o $(SRCDIR)/Dependencies_N.o $(SRCDIR)/Gtkmm_Definitions....
JayY
1

votes
0

answer
662

Views

Segmentation Fault (core dumped) while running my program compiled with g++

I am currently coding my own big project for a Uni assignment. I have nearly completed most of it but I am currently stuck on an error that I am not sure how to fix. Every time I compile my code using g++ and run the resulting program I am given the error 'Segmentation Fault (core dumped)'. I was t...
1

votes
1

answer
156

Views

Linking an openGL library fails because it can't open libgl.so … but it's right there [closed]

I've been getting the following error when I try to make a c++ project with openGL that's been really elusive to me. When i run the make file, I get the following: g++ -c init.cpp g++ -o executable console.o init.o -lglut -lgl /usr/bin/x86_64-linux-gnu-ld: cannot find -lgl collect2: error: ld return...
Duro Dur
1

votes
1

answer
640

Views

Configuring Qt 5.9.5 on Ubuntu 16.04

I recently started working with Qt. I was trying some simple widgets. It was working as intended with no errors and suddenly Qt doesn't work anymore. I did not change any configuration/settings. I restarted my computer and I started to get the following error. I have no idea how to fix them. Error (...
Skyrider
1

votes
1

answer
23

Views

Pass arguments to the compiler via MAKE

When I try to build code: make -C ./source/SomeUtil mode=release it fails with an error: fatal error: template instantiation depth exceeds maximum of 35 (use -ftemplate-depth= to increase the maximum) It seems somehow I need to force MAKE to pass that argument to the compiler: -ftemplate-depth=50 I...
Dmitriy
1

votes
1

answer
187

Views

How to stop CMake from passing platform specific flags to compiler?

I'm trying to cross-compile my application. I created a CMake file that builds my application with Emscripten which works as expected. Now I'm modifying the CMake file to compile my application with MinGW. The problem is that CMake is passing MacOS flags that Windows g++ doesn't recognize. CMake is...
Kerndog73
1

votes
2

answer
153

Views

compile the c++ amqp-cpp demo program err, make err

I want to write a test program with amqpcppCopernicaMarketingSoftware/AMQP-CPP. But the compiler(g++) complains: g++ main.cpp rabbitmq_handler.cpp -std=c++11 -lamqpcpp -lpthread -ldl In file included from /usr/local/include/amqpcpp/linux_tcp.h:2:0, from /usr/local/include/amqpcpp/libevent.h:23, from...
jam dc

View additional questions