"Ogre.h" include not found Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
urquhart
Gnoblar
Posts: 2
Joined: Tue Dec 11, 2018 8:04 pm

"Ogre.h" include not found

Post by urquhart »

Ogre Version: :1.11: (I think)
Operating System: :Ubuntu 18.04:
Render System: :?:
Hi,
I am new to Ogre (and new to using cmake). I followed the tutorials https://ogrecave.github.io/ogre/api/lat ... -ogre.html and https://ogrecave.github.io/ogre/api/latest/setup.html. Then I tried tried to compile the program from the "Setting up" tutorial, but it wouldn't find the "Ogre.h" include.

cmake output:

Code: Select all

-- Found OGRE
--   static     : OFF
--   components : Bites;HLMS;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
--   plugins    : Plugin_BSPSceneManager;Plugin_CgProgramManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GL3Plus;Codec_STBI
--   media      : /usr/local/share/OGRE/Media
-- Configuring done
-- Generating done
-- Build files have been written to: /home/julian/OGRE/OgreProjects/FirstSteps/build
make output:

Code: Select all

/home/julian/OGRE/OgreProjects/FirstSteps/src/main.cpp:2:10: fatal error: Ogre.h: No such file or directory
 #include "Ogre.h"
          ^~~~~~~~
compilation terminated.
CMakeFiles/hello.dir/build.make:62: recipe for target 'CMakeFiles/hello.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/hello.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/hello.dir/all' failed
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
This is my CMakeLists.txt:

Code: Select all

cmake_minimum_required(VERSION 3.10.2)
project (directory_test)

include_directories(include)

file(GLOB SOURCES "src/*.cpp")

find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem)
file(COPY ${OGRE_CONFIG_DIR}/resources.cfg DESTINATION ${CMAKE_BINARY_DIR})

add_executable(hello ${SOURCES})
I think this is about adding the /usr/local/include directory to the include-paths through cmake, but that's where I kept failing (adding every single subdirectory manually through include_directories seems wrong).
Please bear with me if this is a very stupid beginner's mistake ;)
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: "Ogre.h" include not found

Post by paroj »

urquhart
Gnoblar
Posts: 2
Joined: Tue Dec 11, 2018 8:04 pm

Re: "Ogre.h" include not found

Post by urquhart »

Thank you very much, that solved the include problem.
However, now I get these errors when linking:

Code: Select all

Scanning dependencies of target hello
[ 50%] Building CXX object CMakeFiles/hello.dir/src/main.cpp.o
[100%] Linking CXX executable hello
/usr/bin/ld: warning: libzzip.so, needed by /usr/local/lib/libOgreMain.so.1.11.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libfreetype.so.2.9, needed by /usr/local/lib/libOgreOverlay.so.1.11.5, not found (try using -rpath or -rpath-link)
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_file_close'
/usr/local/lib/libOgreOverlay.so.1.11.5: undefined reference to `FT_Init_FreeType'
/usr/local/lib/libOgreOverlay.so.1.11.5: undefined reference to `FT_Set_Char_Size'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_error'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_file_read'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_strerror_of'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_dir_close'
/usr/local/lib/libOgreOverlay.so.1.11.5: undefined reference to `FT_Load_Char'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_dirhandle'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_dir_read'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_tell'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_dir_open_ext_io'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_seek'
/usr/local/lib/libOgreOverlay.so.1.11.5: undefined reference to `FT_New_Memory_Face'
/usr/local/lib/libOgreOverlay.so.1.11.5: undefined reference to `FT_Done_FreeType'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_dir_stat'
/usr/local/lib/libOgreMain.so.1.11.5: undefined reference to `zzip_file_open'
collect2: error: ld returned 1 exit status
CMakeFiles/hello.dir/build.make:104: recipe for target 'hello' failed
make[2]: *** [hello] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/hello.dir/all' failed
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Current CMakeLists.txt:

Code: Select all

cmake_minimum_required(VERSION 3.10.2)
project (directory_test)

include_directories(include)

file(GLOB SOURCES "src/*.cpp")

find_package(OGRE 1.11 REQUIRED COMPONENTS Bites RTShaderSystem)
file(COPY ${OGRE_CONFIG_DIR}/resources.cfg DESTINATION ${CMAKE_BINARY_DIR})

add_executable(hello ${SOURCES})
target_link_libraries(hello ${OGRE_LIBRARIES})
Post Reply