ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 10:27 am

So you were trying to fuse your Makefile with the provided by ajstarks , correct ?

You are using Makefiles , correct ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 10:33 am

I am just using Geany, nothing else.
And yes, I try to fuse my Geany settings by those of AJStarks
The settings above are the settings of Geany so far - I don't use anything else, so no extra-makefile additionally to Geany.

BTW, I also already tried the following settings:

Code: Select all

(for compile:) g++ -Wall -o  "%f" -lpthread -lrt -lwiringPi -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads  -o -lshapes

(for make:) g++ -Wall -o "%e" "%f" -lpthread -lrt -lwiringPi -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads  -o -lshapes
for my own file
openvg_helloworld.c
(which is actually identical to hellovg.c in /home/pi/openvg/client,
I just renamed it and stored it to a different working dir),
I now get:
g++ -Wall -o "openvg_helloworld.c" -lpthread -lrt -lwiringPi -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o -lshapes (im Verzeichnis: /home/pi/programs/openvg)
Kompilierung fehlgeschlagen.
/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crt1.o: In function `_start':
/build/glibc-IRmfEu/glibc-2.19/csu/../ports/sysdeps/arm/start.S:119: undefined reference to `main'
collect2: error: ld returned 1 exit status
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
ajstarks
Posts: 129
Joined: Fri Jun 22, 2012 2:14 am

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 12:48 pm

Given:

[email protected] ~ $ gcc -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads anysource.c -o anysource -lshapes
[email protected] ~ $ ./anysource

Here is the explanation:

1) gcc (the command the compile your code_
2) -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads (the directories to search for include files)
3) anysource.c (your file that you want to build)
4) -o any source (the output of the executable, this is what you run)
5) -lshapes (the OpenVG library that you installed)
6) ./anysource (run the executable you just built)

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 1:03 pm

I'm using g++, not gcc
how is the Geany parameter line fusioned with

(for compile:) g++ -Wall -o "%f" -lpthread -lrt -lwiringPi

(for make:) g++ -Wall -o "%e" "%f" -lpthread -lrt -lwiringPi
?

I don't use command line ever, far too much to type every time, I am only using the Geany parameters

BTW,
mysource.c is clear
what is anysource?

...mysource.c -o anysource -lshapes

mysource.c is "%f", correct?
which part has to be altered for "%e" ? anysource?
or other way round?

compile:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "%f" -lshapes -lpthread -lrt -lwiringPi
make:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads "%e"-o "%f" -lshapes -lpthread -lrt -lwiringPi

?

edit:
brings this:

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "hellovg.c" -lshapes -lpthread -lrt -lwiringPi (im Verzeichnis: /home/pi/openvg/client)
/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crt1.o: In function `_start':
/build/glibc-IRmfEu/glibc-2.19/csu/../ports/sysdeps/arm/start.S:119: undefined reference to `main'
collect2: error: ld returned 1 exit status
Kompilierung fehlgeschlagen.
Last edited by davenull on Sun Oct 25, 2015 1:17 pm, edited 5 times in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 1:06 pm

Please have a look into my links. Understand when to use g++ and when to use gcc.

Using Geany will not help you in the long run, especially when you need code from third parties.
Embrace the Unix way : editor , compiler , Makefiles.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 1:07 pm

no, I will always use Geany , never ever command line.

I'm using g++ as in most of all cases I'm using C++ classes and libs (additionally).

I need to have all parameters fusioned in Geany IDE.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

[resolved:] HDMI: font sizes, simple graphics by g++ C

Sun Oct 25, 2015 1:59 pm

I think now I have it finally:

Geany settings for compile:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -c "%f" -lshapes -lpthread -lrt -lwiringPi

Geany settings for make:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "%e" "%f" -lshapes -lpthread -lrt -lwiringPi

seems to work, just a warning about strings:
hellovg.c:22:77: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Return to “C/C++”