Compiling C++ files
Posted: Wed Jul 06, 2016 3:59 pm
When compiling C++ files using the Terminal Window do you add a + sign to gcc vis gcc+. also where should any 'include' libraries be stored within Rpi3.
A small, affordable computer with free resources to help people learn, make things, and have fun
https://www.raspberrypi.org/forums/
https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=153645
try g++fotoartist78 wrote:When compiling C++ files using the Terminal Window do you add a + sign to gcc vis gcc+. also where should any 'include' libraries be stored within Rpi3.
$ g++ -vfotoartist78 wrote:When compiling C++ files using the Terminal Window do you add a + sign to gcc vis gcc+. also where should any 'include' libraries be stored within Rpi3.
Code: Select all
void EchoArgs(int,const char*const[]);
Code: Select all
#include <iostream> //<system> headers
#include "c.hpp" //"your" headers
int
main(int argc, char *argv[])
{
EchoArgs(argc,argv);
return 0;
}
void
EchoArgs(int na,const char*const av[])
{
std::cout << "There are " << na << " arguments..\n";
for (
int i =0;
i < na;
i++
)
std::cout << av[i] << '\n'
;
}
Code: Select all
sudo apt-get update
sudo apt-get install libudev-dev
Think of the system include (header) files as a description of the capabilities of your system and the system library files (libs) as the implementation of those descriptions. With that in mind, it is your decision.fotoartist78 wrote:Many thanks Marcus and 'swampdog' for replies, that has clarified things for me, but neither of you answered the last part of my question "Where should any Include libraries be installed within the Pi3 filing system."
Ah. Now the tables are reversed. I know nothing of this.fotoartist78 wrote:Once again 'swampdog' for your suggestions but I am afraid a lot of it was above my head. You see,I have only had my Pi3 for a few weeks so I am really a 'beginner' and am still struggling to understand many of the command line entries. Basically what I want to do try out an Ardiuno sketch which I wrote and which rubs OK on Arduino but on th Pi3. The sketch has an include line :-
#include <IRremote.h> . I have the file 'IRremote' buit I do not know where or how to install it on the Pi3 so that at when compiling the sketch on the Pi3 the system knows where to find the include file. Any help you can give in simple terms would be gtreatly appreciated.