Click here to Skip to main content
15,887,214 members
Everything / g++

G++

g++

Great Reads

by pasztorpisti
An advice to make your DLL interface more attractive and easier-to-maintain even in cross-platform projects
by Andy Kirkham
Part 2 - Stepping into the C++ world
by honey the codewitch
Explore the inner workings of a highly capable IoT display driver for the ESP32
by Marius Bancila
An introduction to cpplinq, a open-source template library that provides LINQ-like operators for querying collections (arrays and STL containers) in C++11.

Latest Articles

by honey the codewitch
Explore the inner workings of a highly capable IoT display driver for the ESP32
by pasztorpisti
An advice to make your DLL interface more attractive and easier-to-maintain even in cross-platform projects
by Frank-Rene Schaefer
Using Quex to generate lexical analyzers
by Tim ONeil
INI-style properties for C++ Embedded/Applications on Linux

All Articles

Sort by Score

g++ 

19 Feb 2016 by pasztorpisti
An advice to make your DLL interface more attractive and easier-to-maintain even in cross-platform projects
6 Apr 2013 by CPallini
Under Linux you usually want to make .so files (Linux can't consume Windows DLLs).Here you may find a guide: "Intro to Linux Shared Libraries (How to Create Shared Libraries)"[^].
8 Aug 2013 by Manfred Rudolf Bihy
You're using the wrong format code %d (Scan an integer as a signed decimal number) it should be %s (Scan a character string).Read here to learn more: http://en.wikipedia.org/wiki/Scanf_format_string[^]Regards,— Manfred
12 Nov 2012 by Andy Kirkham
Part 2 - Stepping into the C++ world
5 Nov 2019 by Stefan_Lang
I strongly suspect this is a bug in the compiler's code optimization: M isn't read by the program, so the compiler will try to eliminate code referring to it - maybe it messed up this optimization because the statement cin>>N>>M internally translates into a nested function call:...
6 May 2021 by honey the codewitch
Explore the inner workings of a highly capable IoT display driver for the ESP32
6 Dec 2021 by k5054
Have you tried the always_inline attribute? See the attribute specification documentation over at cppreference.com[^] That requires C++-11, so will hopefully be available for your G++ tool chain. Also see Optimize Options (Using the GNU Compiler...
8 May 2014 by pitonyak
I use the following in my PRO filesQuote:QMAKE_CXXFLAGS += -std=c++0xDetermine which flags are required by your compiler (and it looks like your error message makes two suggestions).
25 Sep 2014 by cxxxxf
int main(int argc, char* argv[]){ int* p = new int[10]; for (int i = 0; i
25 Sep 2014 by Leo Chapiro
The error is clear, I think: just change //for (int i = 0; i
21 May 2020 by Shao Voon Wong
It means compile program.cpp and output(-o) the executable named "program"
21 May 2020 by Rick York
Make sure the file gtest/gtest.h exists. It has to be in a gtest subdirectory of one of the directories on your include path. That is because you enclosed the name with angle brackets. Personally, I would change the angle brackets to double...
6 Aug 2012 by YvesDaoust
In front of the technical difficulties, I am giving up the idea to use inline assembly.As in any case a full rework of the source code is required, this opens new options.The option I have chosen is to switch to the SSE intrinsics calls, as they are portable between Microsoft and GNU...
18 Dec 2012 by Software.ameen
Hi , I wanna install g++ compiler to compile C++ file through Vmware workstation.is there any command to install g++ via workstation ?can i install that normally ?I am eagerly waiting to know the answer.. Thanks in Advance,Noorul Ameen.A
18 Dec 2012 by Abhishek Pant
to install g++-4.1apt-get install g++-4.1{,-multilib}for more help VMware[^]Installing g++ on Windows and Ubuntu Linux[^]
6 Apr 2013 by 125Azazelo
Hi i have beginner question how to make .so and .dll from .cpp in Linux?I have simple project no thread , 2 .h files ,and 2 .cpp files.
24 Jun 2013 by unscathed18
Hi, there are a few things I like to ask related to Codeblocks IDE with GCC/G++:1) I'd like to know if there's any good tutorial or web explaining how to exploit gcc's debug options. What I mean is, my intention is that when I use the 'debug' build instead of 'release' build, I want for...
8 Aug 2013 by sid2x
I am developing a simple program in C,but I encountered a problem :My Code :#includeint main(){ int menuinpt; printf("Welcome to C game!!!!\n"); printf("1. Play Game\n"); read: printf("Enter a Command to start : "); scanf("%d", &menuinpt); if...
23 Aug 2013 by Chakraveer Singh
I am using Linux x86_64 machine to build my program. I have linked a shared library to an executable. In my project I am calling a function which has declared vector inside the function. My program gets killed when that function gets called. When debugging through GDB below is the output I...
13 Nov 2013 by David Serrano Martínez
Consider this code, compiled with g++ v.4.8.1-4 in Code::Blocks 10.05:#ifndef ERROR_SAMPLE_H#define ERROR_SAMPLE_H#include #include #include // Class: my_traits_typestruct my_traits_type : public std::char_traits{};// Class:...
25 Sep 2014 by User 59241
1. If you used new use delete, if you used new[] then use delete[].http://stackoverflow.com/questions/4255598/delete-vs-delete[^]2. How the compiler knows is compiler dependent.http://stackoverflow.com/questions/975792/how-does-delete-know-the-size-of-an-array[^]3. See above
5 Mar 2015 by PaulS_UK
HiI'm trying to port a large CPP project into linux to run on a Raspberry Pi.One of the files PROG_WIN.CPP allows a user to interrupt the program. I have had to substitute an old Borland header #include with#include which I belive should be able to directly handle...
5 Mar 2015 by PaulS_UK
Thanks Richard - I have tried both!For others with a similar problem; this link seems promising:http://forums.fedoraforum.org/showthread.php?t=172337[^]
14 Mar 2015 by Vedant Dave
I want to split LinkList by a given threshold value,means if the count of Link List is greater than Threshold value then the Linked List should split from middle,and then recursively if existing 2 linked list count is larger than threshold value then the list will be further split in to 2...
4 Jun 2015 by KarstenK
Some search path for the include is missing. At first search the file "window.h" on your hard disk. If found add this sub path to your compiler path else install the SDK.Maybe removing the "wx/ part solves the problem?
17 Aug 2017 by KarstenK
I personally prefer other API like WriteFile which also works with COM ports. The link is good starting point to get an overview with some links to sample code. Take also a look at this great article about Serial library for C++.
5 Nov 2019 by Shubham Avasthi
I was working on a C++ code, which for some unknown reason, does not terminate by Ctrl + C. The below code is a reduced version of the code I was working on and it has the same issue. Moreover, if I don't take an input for M (remove '>>M') or remove vector a(n) or initialize the size of vector...
5 Nov 2019 by RickZeeland
Might be a debugger issue, see: Workaround for GDB Ctrl-C Interrupt | MinGW[^]
9 Sep 2022 by Ahmad Qassym
when i am trying to compile my Code in c++ using the g++ compiler(suing linxu mint) by the command g++ A.cpp i get the response : g++: error: A.cpp: No such file or directory g++: fatal error: no input files compilation terminated. What I...
18 May 2020 by CPallini
The error is clear: the C++ compiler (g++) cannot find your source file (A.cpp). Just make sure you are running g++ in the same folder wherein is your source file (alternatively you may pass the full path of your source file to g++).
18 May 2020 by k5054
g++ is unable to locate the file A.cpp. Is that file in your current directory? Is it perhaps a.cpp or A.CPP? Do ls in your current working directory and see.
18 May 2020 by KarstenK
Take the compiler messages serious: it is your best friend in programming. ;-) Your A.cpp file is missing. Maybe you have moved, deleted or renamed it. So you need to change your project settings or make file or restore from your trashbin. PS:...
7 Dec 2021 by honey the codewitch
Overall I must optimize my code for size, due to targeting IoT devices which have small amounts of SRAM with which to code for execution, and which have small program flash sizes, but there are some situations where I need trivial functions to be...
7 Dec 2021 by Stefan_Lang
I never tried that myself just for this purpose, but have you considered wrapping the code in question into a template function? If I'm not mistaken that should force it to be inline. E. g.: template void address_window_internal(T...
17 Mar 2023 by Phoenix Liveon
How do we properly create an overloaded operator specifically this "
17 Mar 2023 by klarrra
Find some good help here. https://kbrown.hashnode.dev/c-in-computer-science
3 Nov 2012 by Marius Bancila
An introduction to cpplinq, a open-source template library that provides LINQ-like operators for querying collections (arrays and STL containers) in C++11.
10 Nov 2012 by Andy Kirkham
Part 1 - Setting up and getting started
5 Nov 2019 by CPallini
On my Linux box (Ubuntu 18), the following program #include #include using namespace std; int main() { int N,M; cin>>N>>M; vector a(N); } compiled with the g++ -O3 -std=c++14 (g++ 7.4.0) behaves as espected.
12 May 2014 by Anna Koneva
An article about interoperation issues in mixed C/C++/Objective-C development
16 Dec 2015 by Tim ONeil
INI-style properties for C++ Embedded/Applications on Linux
26 Dec 2015 by Frank-Rene Schaefer
Using Quex to generate lexical analyzers
17 Oct 2012 by Alexander Schwoch
This is an alternative for "Fault Tolerance for Large Files on Cranky Hardware"
2 Aug 2012 by YvesDaoust
I am porting existing code from Windows to Linux (Visual C++ to g++). It includes inline assembly sections.g++ supports a compilation switch (-masm=intel) telling it to accept the Intel syntax instead of the AT&T one. So far so good, it should avoid painful rewriting of thousands of...
4 Sep 2012 by jk7.seo
you have to use both syntax..ex)#define TEST(out, in) \ asm\ ( \ "mov %1, 5\n\t"\ ".intel_syntax noprefix;" \ --------intel syntax -------- ".att_syntax;" \ :"=g" (out) \ ...
23 Feb 2013 by H.Brydon
I would suggest making sure that all the underlying libraries and packages are up to date. Try it this way:sudo apt-get updatesudo apt-get upgradesudo apt-get install g++If you haven't done the update/upgrade for a while, your system might be too uncooperative to accept the...
9 Sep 2013 by Member 10258053
#include #include #include #include int main ( int argc , char ** argv ) { std::random_device rd; std::mt19937_64 gen(rd()); std::uniform_real_distribution dis(0, 1); std::cout
17 Aug 2017 by Member 12915728
Please share info on how to functionally access ports in Windows 10 using C++ (compiled with g++). Please include all #include files and code necessary to test I/O Parallel Port Pin Programming. Thank you What I have tried: /*** Following Code Compiles but DOES NOT modify ports ***/ ...
25 Feb 2013 by CodingLover
Hi all,When I run sudo apt-get install g++ terminal display that so many packages I has are the newest version on Ubuntu 12.10. But even after I cannot compile any c++ files. Any comment on this highly appreciate.Note: This Ubuntu 12.10 installation running inside a vertual box which is...
10 Sep 2013 by Member 10258053
it compiles without problems when I use the version compiler gcc/4.7.2 Thank you.
5 May 2014 by Arun Kumar K S
I am trying to create an i2c communication in raspbery Pi(debian wheezy) using Qt creator with rpi-hw library. I successfully compiled and installed the rpi-hw library in my linux system. But when I try to include this in my Qt. Got the following...
4 Jun 2015 by ArbolOneDotOrg
Even though Code Blocks has a template for wxWidgets, I’d like to start my application from zero. So, I created an application using the ‘Console Application’ template and added the ‘#include ’ as the first step, as suggested here. But I get an error saying...
21 May 2020 by Ahmad Qassym
what deos it mean when we write in terminal(linux): g++ -o Program Programm.cpp What I have tried: i have written the command : g++ -o program program.cpp
22 May 2020 by Ahmad Qassym
i write test functions in c++ (linux) that look like : #include #include"./ApproximationOfPi.cpp" //-lgtest -lpthread Test(ApproximationOfPiTest,computeNumPointsInCircle) { ASSERT_EQ(3,computeNumPointsInCircle(1)); ...