Author Topic: Can't add X11 to search directory  (Read 10628 times)

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Can't add X11 to search directory
« on: December 13, 2021, 05:08:35 pm »
Hello

First time user and poster for Code Blocks IDE.

I'm having an issue with X11/Xmu/WinUtil.h in that Code Blocks can't see it and as get the error:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h|43|fatal error: X11/Xmu/WinUtil.h: No such file or directory
when I attempt to build or compile.

Now I've tried adding the /usr/include/X11 folder to the search directory in the build options of the project, but for some reason it can't see it.
And I know I have the X11/Xmu/WinUtil.h header in the /usr/include/ folder from the file explorer

I have attached screenshots of the IDE's directory search and my OS's file explorer as proof of this issue as X11 is one folder Code Blocks can't seem to see.

It would help if I knew what was wrong, or if I'm thinking about the solution in the wrong way.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #1 on: December 13, 2021, 11:42:24 pm »

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #2 on: December 16, 2021, 04:04:27 pm »
I am running Code::Blocks version Code::Blocks 20.03 on Zorin OS 16 Core.
The compiler I use is GNU GCC Compiler
version gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04).

When I import a VS code sample project using a 3rd Party SDK (Ultra App Kit) and added in the needed include folder in the directory search for the 3rd Party SDK everything seems fine.
Until I go to build / Compile where it asks for X11/Xmu/WinUtil.h, which is in the usr/include/ folder on the system.
The header file asking with the line; #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
is part of the 3rd Party SDK, and yes, I ran sudo apt-get install libxmu-dev to make sure it was installed.

Though now that I look at the order of includes in that file something seems a bit weird.
As just above the line with an error is; include <X11/Xlib.h>           // `apt-get install libx11-dev`
so is Code::Blocks not doing a recursive check in the /usr/include/X11 folder?
Or do I need to rebuild a certain file somewhere so the compiler can more easily see it?


Build log:
Code
-------------- Clean: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

Cleaned "Testing - Debug x64"

-------------- Build: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp" -o Debug/Source/main.o
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
 
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))


I've tried to get the IDE to include usr/include/X11 in the search directory list and it can't see the X11 folder in the usr/include/ location.
I have a tried Looking for a VC++ compiler since I am importing a VS code sample project even loading the mingw compiler.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Can't add X11 to search directory
« Reply #3 on: December 16, 2021, 04:19:33 pm »
This part
Code
-I/Include/
is not correct, it should look something similar to this
Code
-I/usr/include

Look in the project's search folders for the error

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #4 on: December 16, 2021, 05:00:10 pm »
I gave that a shot and got the same error.

It is like as I mentioned in the OP, Code::Blocks can not seem to see the X11 folder when doing the directory search, and in the second post noted something weird.

As the file that has the issue is like this:
Code
	....
#include <X11/Xlib.h>           // <-- does Fine
#include <X11/Xmu/WinUtil.h>    // <-- Gives error
#include <X11/Xatom.h>
...

How can X11/Xlib.h be fine, but X11/Xmu/WinUtil.h not be?

Here's the Build Log:
Code
-------------- Clean: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

Cleaned "Testing - Debug x64"

-------------- Build: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp" -o Debug/Source/main.o
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Can't add X11 to search directory
« Reply #5 on: December 16, 2021, 05:08:35 pm »
Quote
I've tried adding the /usr/include/X11 folder to the search directory in the build options

Somehow you failed and ended adding /Include/ also (note the uppercase I). The second folder is OK.

Have you installed libxmu-dev? The error says this:

Quote
No such file or directory #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #6 on: December 16, 2021, 05:13:55 pm »
Quote
I've tried adding the /usr/include/X11 folder to the search directory in the build options

Somehow you failed and ended adding /Include/ instead (note also the uppercase I). The second folder is OK.

Have you installed libxmu-dev? The error says this:

Quote
No such file or directory #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev

The the one after /Include/, is -I/usr/include in the log as I used the GUI to add the /usr/Include directory.
To get what I mean look at Images in the OP to see what I mean about /usr/include/X11, and Code::Blocks not seeing it.

And as I said in the second post, I did run sudo apt-get install libxmu-dev in the terminal to ensure X11/Xmu/WinUtil.h was installed.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #7 on: December 17, 2021, 11:32:19 am »
is X11/Xmu/WinUtil.h in your file system? Have you actually checked id the file is there? only running
Code
apt-get install libxmu-dev
does not ensure that the file is there :)

can you run
Code
tree /usr/include > test.txt
in a shell/bash in your home directory, zip the generated test.txt and post it here?

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #8 on: January 11, 2022, 03:59:07 pm »
Hey

Sorry for the delay, was busy with Christmas and some stuff in the New year
Yes, I checked that the file existed, and it does.

Here is the tree of /usr/include in the test file.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #9 on: January 11, 2022, 10:02:24 pm »
Linux file system is case sensitive... Are the x in your includes the same case? They should be upper case according your tree output

have you tried to switch order of includes?
Have you checked the access rights to the Xmu folder?

it is not codeblocks that is giving you errors, but gcc...

can you run
Code
c++ -xc++ /dev/null -E -Wp,-v 2>&1 | sed -n 's,^ ,,p'
in your console and post the result here?

This has to be some stupid error, where we all will head bang when it works...
« Last Edit: January 11, 2022, 10:14:41 pm by BlueHazzard »

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #10 on: January 13, 2022, 07:19:06 pm »
....

This has to be some stupid error, where we all will head bang when it works...

Your not the only one that thinks this, or this is a strong beer bug.
Gotta keep a sense of humour with annoying programming issues.

I've dumped the results of the terminal into files attached to post.
One covering compiler the other the permissions of the X11 folder in /usr/include


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #11 on: January 13, 2022, 09:21:25 pm »
Looking at your files, confirms that "/usr/include" is in the default search path, so #including <X11/Xmu/WinUtil.h> should result in /usr/include/X11/Xmu/WinUtil.h

Ok ,i am somehow out of ideas:

I tried to reproduce your problem, the steps i did:
1) Set up fresh linux Mint
2)
Code
sudo apt-get install libx11-dev
3)
Code
sudo apt-get install libxmu-dev
4) Open codeblocks, create a c++ console project
5) paste
Code
#include <X11/Xmu/WinUtil.h>    // <-- Gives error
#include <X11/Xatom.h>
#include <X11/Xlib.h>           // <-- does Fine
6) Hit compile

everything compiles fine...

i also added your include directories (beside the steam things) and still everything worked fine...

have you tried to call in your project folder
Code
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
directly in console and look at the output?

Also you can try to call (note the added -v -E)
Code
g++ -v -E -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
and look at the include directories if you can find something

Are you running in a linux on windows system, or native linux system?


Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #12 on: January 14, 2022, 04:51:44 pm »
I tested with a NEW console project (Hello world) on my ZorinOS 16 Core Virtual Machine

only adding /usr/include in the search directories for Code::Blocks

and it fails on X11/Xmu/WinUtil.h

it sees other directories in the X11, but not the Xmu directory.
As I decided to manually re-type the include statement and the auto-fill did not list X11/Xmu
as I did not find it between Xmd.h and Xos.h

Yeah, this is a rare head scratcher of a problem.

--

Is there a way to get the IDE to run as Root, to test if it is a permission issue of some sort, or some other issue?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #13 on: January 14, 2022, 04:56:07 pm »
Is there a way to get the IDE to run as Root, to test if it is a permission issue of some sort, or some other issue?

simply run codeblocks with "sudo codeblocks".

but then all created files will be owned by root.

Have you tried the commands i wrote? you can try them with root too.

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #14 on: January 14, 2022, 05:48:31 pm »
I've run those commands (sudo) when setting up codeblocks and even used Synaptic package manager to re-install them encase something was corrupted.

And I can't run CodeBlocks as sudo in the terminal
Code
ryos@ZorinVM:~$ sudo codeblocks
sudo: codeblocks: command not found

Seems I must have a different version of code-blocks installed.

I'll try using the one from the Zorin repo using
Code
sudo apt-get install codeblocks
and the console project works now.

So their is an Issue with one from the software centre, Version: 20.03, Updated: 2021-12-06,  sourced from dl.flathub.org.
While the apt-get one works.