Author Topic: non-standard include directories and cmake  (Read 6386 times)

Offline seasoned_geek

  • Single posting newcomer
  • *
  • Posts: 9
non-standard include directories and cmake
« on: November 19, 2021, 11:39:02 pm »
All,

I used the command line to convert a small demo CMake application to Code::Blocks. Under CMake it builds and runs.

Ubuntu 20.04 LTS.

ame             : Code::Blocks
Version          : 20.03-r11997
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxGTK port)
Version 3.0.4 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.14.

My issue seems to be related to this question:

https://forums.codeblocks.org/index.php/topic,24485.0.html

Forum software complained that message was over 120 days old and requested I create a new topic.

||=== Build: all in ThreeScreens (compiler: GNU GCC Compiler) ===|
/home/developer/Projects/ThreeScreens/testapp.h|4|fatal error: Screen.h: No such file or directory|
 [CMakeFiles/ThreeScreens.dir/build.make|76|CMakeFiles/ThreeScreens.dir/testapp.cpp.o] Error 1|
/home/developer/Projects/ThreeScreens/testapp.h|4|fatal error: Screen.h: No such file or directory|
 [CMakeFiles/ThreeScreens.dir/build.make|63|CMakeFiles/ThreeScreens.dir/main.cpp.o] Error 1|
 [CMakeFiles/Makefile2|76|CMakeFiles/ThreeScreens.dir/all] Error 2|
 [/home/developer/Projects/ThreeScreens/build/Makefile|106|all] Error 2|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

I am no expert but the project file looks correct.



In the IDE, not so much.



Even if I manually add the search path



It still errors out. Doesn't matter if I put "" around the include file or <>

1) Is there a version where this has been fixed?

2) What is the work around? We have to use CMake. I was setting Code::Blocks up in the development VM because some of the team cannot function without an IDE.  We use CMake to build inside of a container and there is no changing that.

I just need to find and document a workable path for other team members.

If you need to see the CMakeLists.txt and source, that is fine. This is just a dumb little 3-screen NanoGUI demo program. Absolutely nothing proprietary (or useful) about it.

Thanks,


Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: non-standard include directories and cmake
« Reply #1 on: November 20, 2021, 12:32:34 am »
I have not used the "Project->Properties->C/C++ parser options" and I have not played with CMAKE.

To change you go into the "Project->Build Options" menu and then select the "Search Directories" tab and then add/change/update the paths that are required for either the compiler or linker or resource compiler by selecting the appropriate tab.

Is the header "Screen.h" (case check as well) in one of the search directories specified?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7319
    • My Best Post
Re: non-standard include directories and cmake
« Reply #2 on: November 20, 2021, 03:33:07 am »
FYI: Unless Cmake has changed it does not make an normal CB project instead it makes an CB custom makefile project.

The above was true about two years ago; but, cmake might make an normal CB project now.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline seasoned_geek

  • Single posting newcomer
  • *
  • Posts: 9
Re: non-standard include directories and cmake
« Reply #3 on: November 20, 2021, 11:24:07 am »
I have not used the "Project->Properties->C/C++ parser options" and I have not played with CMAKE.

To change you go into the "Project->Build Options" menu and then select the "Search Directories" tab and then add/change/update the paths that are required for either the compiler or linker or resource compiler by selecting the appropriate tab.

Is the header "Screen.h" (case check as well) in one of the search directories specified?

As stated with original post, this project builds and runs with CMake and the command line. Was just looking for a near painless path to IDE support for junior members who cannot function without an IDE.

What version of Code::Blocks are you using? Here is what I see for Project->Build Options



There is no "Search Directories" tab. As stated in the original post, the only place I found "search paths" was here.



That made absolutely zero difference.

You did hit on something rather remarkable though.



This thing actually built and ran with miss-matched case. Should never have worked.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7319
    • My Best Post
Re: non-standard include directories and cmake
« Reply #4 on: November 21, 2021, 12:39:08 am »
FYI: When using an custom makefile project in the CB IDE some things to check are
1. The location of the CB Project file along with the location of the custom makefile the relative location is often a problem
2. The "Make" commands
3. The toolchain setting is using the same make executable as you are from the command line
Note: I have never heard the Linux people have item 3 problems; but, Windows people do sometimes.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7319
    • My Best Post
Re: non-standard include directories and cmake
« Reply #5 on: November 21, 2021, 04:41:09 pm »
FYI: Linux is case sensitive on filenames.

This means "Screen.h" and "screen.h" are different files.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline seasoned_geek

  • Single posting newcomer
  • *
  • Posts: 9
Re: non-standard include directories and cmake
« Reply #6 on: November 22, 2021, 02:20:07 pm »
FYI: Linux is case sensitive on filenames.

This means "Screen.h" and "screen.h" are different files.

Tim S.

This I know. What I'm saying is it built from the command line on Linux before it was pasted into files for CB. Most odd. That's not an NTFS or FAT32 drive either. I've only seen that happen with those when shared with Windows.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7319
    • My Best Post
Re: non-standard include directories and cmake
« Reply #7 on: November 22, 2021, 03:53:19 pm »
So, are you ever going to try to fix this problem?

Are you going to post where the CB Project is related to the custom makefile?

Are you going to post the custom makefile?

Are you going to admit you are using an CB custom makefile project?

Are you going to try to figure out the correct command to build using the custom makefile from the command line?

And, then edit the CB project make commands to work?

Me, I have given up; I feel we are failing to communicate we each other.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org