Which libs to put?

Good day.
I'm trying to learn programming by myself, today it's a hobby. I decided to stop on Linux, Bash, C ++, Scheme, and not to use IDE now. I go here with a hope to seek the advices and answers, if any will be, but I beg do not urge that my choice ( Linux, Bash, C ++, Scheme, and not to use IDE now) is need to change. The site impress! Examples are giving a hope, there is wish to dive in learning, that and was done. Although a keen wish to see even smallest window is present still. A windowing cause many problems. My Debian8.8 and it's Synaptic allowed me load many all, but because I'm still stupid my File Manager with heaps of folders has inclining me to fear. While I was doing examples from this site and cppreference.com everything was fine, I had enough putting examples and a link to g ++ in a separate folder. However the attempt

----------------------------------
* Simple Xlib application drawing a box in a window.
* gcc input.c -o output -lX11
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{------------- etc.
----------------------------------

had been spitting:
----------------------------------
user@debian:~/My-folder$ g++ -std=c++11 my.cpp
my.cpp:6:22: fatal error: X11/Xlib.h: No such file or directory
#include <X11/Xlib.h>
^
compilation terminated.
----------------------------------

There is not X11/Xlib.h in comp., I searched. I understand that need put libraries, but wish knew what and where. Tell me please. Which libs to put? I had read many about that, but bad English and absent skills don't give answers, though I picked:
https://pocoproject.org/
http://nanapro.org/en-us/
http://fox-toolkit.org/
Now they are lay each in their folder. What further? What packets need still? In common nothing explain in any manuals, I found only http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html#fnref:2 but understood a bit. Prompt what do and where seek info, please. Quickly converse I do not may, yet read carefull. Thank all.
Have you installed libx11-dev?
https://packages.debian.org/jessie/libx11-dev

Apparently Debian 9 released today.
Last edited on
Good day.
I installed libx11-dev via Synaptic, together with support files ~18 MB. I removed files laid in .../doc folder, remainder:
/usr/include/X11
/usr/include/X11/ImUtil.h
/usr/include/X11/XKBlib.h
/usr/include/X11/Xcms.h
/usr/include/X11/Xlib.h
/usr/include/X11/XlibConf.h
/usr/include/X11/Xlibint.h
/usr/include/X11/Xlocale.h
/usr/include/X11/Xregion.h
/usr/include/X11/Xresource.h
/usr/include/X11/Xutil.h
/usr/include/X11/cursorfont.h
/usr/lib
/usr/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu/libX11.a
/usr/lib/i386-linux-gnu/libX11.so
/usr/lib/i386-linux-gnu/pkgconfig
/usr/lib/i386-linux-gnu/pkgconfig/x11.pc

Maybe theirs don't enough?. I presume Synaptic don't have files about "x11" except these.
Example produces:
-------------------
user@debian:~/My-folder$ g++ -std=c++11 my.cpp
my.cpp: In function ‘int main()’:
my.cpp:16:17: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char *msg = "Hello, World!";
^
/tmp/ccyPb87j.o: In function `main':
my.cpp:(.text+0x20): undefined reference to `XOpenDisplay'
my.cpp:(.text+0xc8): undefined reference to `XCreateSimpleWindow'
my.cpp:(.text+0xe1): undefined reference to `XSelectInput'
my.cpp:(.text+0xf2): undefined reference to `XMapWindow'
my.cpp:(.text+0x107): undefined reference to `XNextEvent'
my.cpp:(.text+0x147): undefined reference to `XFillRectangle'
my.cpp:(.text+0x18c): undefined reference to `XDrawString'
my.cpp:(.text+0x1ac): undefined reference to `XCloseDisplay'
collect2: error: ld returned 1 exit status
user@debian:~/My-folder$
---------------------------

Seemingly something is missing. I will try to find. Now about another.
As see example must compiled with gcc:
--------------------
/*
* Simple Xlib application drawing a box in a window.
* gcc input.c -o output -lX11
*/

#include <X11/Xlib.h>
#include <stdio.h>
............ etc.
------------------
but I compiled with "g++ -std=c++11 my.cpp".
May this influence for result? I am not may compile with gcc, "-bash: gcc: command not found", but gcc lays beside with g++ in the folder. What is it?
Thank all.
To actually use the functions that were declared in Xlib.h, you need to link libx11 to your program. Since the library is named libX11, you need to pass the flag -lX11:
g++ -std=c++11 -lX11 my.cpp
It is strongly recommended that you enable warnings:
g++ -std=c++11 -Wall -Wextra -pedantic-errors -lX11 my.cpp
Good day.
All was thus: copy/paste "g++ -std=c++11 -Wall -Wextra -pedantic-errors -lX11 my.cpp" === Enter===
---------------
user@debian:~/My-folder$ g++ -std=c++11 -Wall -Wextra -pedantic-errors -lX11 my.cpp
my.cpp: In function ‘int main()’:
my.cpp:16:17: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
char *msg = "Hello, World!";
^
user@debian:~/My-folder$
--------------
viewing in My-folder, there lays freshest a.out == mouse click == the present window on screen!
Thanks, Max Bozzi!
Well, I feel that need learning g++ deep, and it all on long. At now I have been reading about XCB library, apparently it mandatory thing for all. But I don't know where place for XCB and what take? Synaptic shows many about XCB, if to trust in install of him all must be all right? By the way, there are a lot of already installed: libX11-xcb1; libxcb-composite0; libxcb-dri2-0; libxcb-dri3-0; libxcb-glx0; libxcb-keysyms1; libxcb-present0; libxcb-randr0; libxcb-render0; libxcb-shape0; libxcb-shm0; libxcb-sync1; libxcb-util0; libxcb-xfixes0; libxcb-xv; libxcb1; libxcb1-dev;, maybe it is enough?
Thank all.
Topic archived. No new replies allowed.