TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: JESPER KAAS
from: MARTIN GREGORIE
date: 2020-03-10 12:38:00
subject: Re: Problem with wiringPi

On Tue, 10 Mar 2020 12:37:51 +0100, Jesper Kaas wrote:

> On Tue, 10 Mar 2020 12:20:16 +0100, Jesper Kaas
>  wrote:
>
>>>Are these messages happening at compile time or at link time?
>>>
>>>I suspect its not that these are not defined in the header but that you
>>>aren't linking in the wiringPi library at link time...
>  I am getting closer now:
> Did a new build of wiringPi and saw the following message in the
> terminal:
> NOTE: To compile programs with wiringPi, you need to add:
>     -lwiringPi
>   to your compile line(s) To use the Gertboard, MaxDetect, etc.
>   code (the devLib), you need to also add:
>     -lwiringPiDev
>   to your compile line(s).
>
> So I added the text "-lwiringPi" to the compile and build commands in
> Geany. Now I only get the following error message when running a build:
> g++ -wall -o -lwiringPi "blink" "blink.c" (in directory:
> /home/pi/wiringpi/examples)
> g++: error: blink: no such file or directory Compilation failed.
> There is a file blink.c in directory home/pi/wiringpi/examples, so
> something else is nagging Geany, but what?
>

Most of us set up a make file when doing more than trivial C
compilations, and execute the compilation by running 'make'. Did you do
that?

If not its worthwhile to create a makefile, despite the slightly archaic
format (TAB is required in some lines - spaces are not an acceptable
substitute) because

(a) its quite concise and describes all the steps needed to compile
something together with the dependencies such as needing all modules to
have been compiled before linking and which source files are needed to
compile each module.

(b) make is generally faster than other approaches because make always
does the the minimum amount of work needed to compile a program, e.g. if
you only edited the source for one C module, then make only compiles that
module before re-linking the executable.


--
Martin    | martin at
Gregorie  | gregorie dot org

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.