Ogre DLL Warnings

Problems building or running the engine, queries about how to use features etc.
Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 4:16 pm

Ogre Version: 1.11
Operating System: Windows 10
Render System: OpenGL

Hi,

Visual Studio is giving a huge number (hundreds) of warnings (C2451) such as:
'Ogre::TextureManager::mWarningTexture': class 'Ogre::SharedPtr<Ogre::Texture>' needs to have dll-interface to be used by clients of class 'Ogre::TextureManager'

Upon searching for other threads of this type on the forums, a common factor seems to be that people are building their projects as a DLL. I'm not doing that, the project is built as an application, so I'm at a bit of a loss to explain why I'm getting all these warnings. Any suggestions would be welcome.

Thanks
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Wed Jan 30, 2019 8:17 pm

check OgreExports.h which should define the dll exports to empty when static:

is OGREMAIN_STATIC_DEFINE set for you?

Code: Select all

#ifdef OGREMAIN_STATIC_DEFINE
#  define _OgreExport
#  define _OgrePrivate
#else
#  ifndef _OgreExport
#    ifdef OgreMain_EXPORTS
        /* We are building this library */
#      define _OgreExport __declspec(dllexport)
#    else
        /* We are using this library */
#      define _OgreExport __declspec(dllimport)
#    endif
#  endif
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 8:35 pm

loath wrote:
Wed Jan 30, 2019 8:17 pm
check OgreExports.h which should define the dll exports to empty when static:

is OGREMAIN_STATIC_DEFINE set for you?

Code: Select all

#ifdef OGREMAIN_STATIC_DEFINE
#  define _OgreExport
#  define _OgrePrivate
#else
#  ifndef _OgreExport
#    ifdef OgreMain_EXPORTS
        /* We are building this library */
#      define _OgreExport __declspec(dllexport)
#    else
        /* We are using this library */
#      define _OgreExport __declspec(dllimport)
#    endif
#  endif
I've checked the OgreExports.h in the include directory that I've linked to my project, here is the following code:

Code: Select all

#ifndef _OgreExport_H
#define _OgreExport_H

#ifdef OGREMAIN_STATIC_DEFINE
#  define _OgreExport
#  define _OgrePrivate
#else
#  ifndef _OgreExport
#    ifdef OgreMain_EXPORTS
        /* We are building this library */
#      define _OgreExport __declspec(dllexport)
#    else
        /* We are using this library */
#      define _OgreExport __declspec(dllimport)
#    endif
#  endif

#  ifndef _OgrePrivate
#    define _OgrePrivate 
#  endif
#endif

#ifndef OGRE_DEPRECATED
#  define OGRE_DEPRECATED __declspec(deprecated)
#endif

#ifndef OGRE_DEPRECATED_EXPORT
#  define OGRE_DEPRECATED_EXPORT _OgreExport OGRE_DEPRECATED
#endif

#ifndef OGRE_DEPRECATED_NO_EXPORT
#  define OGRE_DEPRECATED_NO_EXPORT _OgrePrivate OGRE_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef OGREMAIN_NO_DEPRECATED
#    define OGREMAIN_NO_DEPRECATED
#  endif
#endif

#endif
I'm not really sure where to go from here :oops:
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Wed Jan 30, 2019 8:47 pm

i would expect OGREMAIN_STATIC_DEFINE would be defined in ogremain's .vcxproj file or whatever build system you're using if you selected "static ogre" in cmake. search for it under your build folder if you don't see it in an obvious place.
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 8:57 pm

loath wrote:
Wed Jan 30, 2019 8:47 pm
i would expect OGREMAIN_STATIC_DEFINE would be defined in ogremain's .vcxproj file or whatever build system you're using if you selected "static ogre" in cmake. search for it under your build folder if you don't see it in an obvious place.
So I opened OgreMain.vcxproj in a text editor and ran a search for OGREMAIN_STATIC_DEFINE and there are no results. Does that mean then that I built Ogre incorrectly for the way that I'm trying to link it to my project?

Edit: My project runs with Ogre working, but obviously it has the hundred of warnings
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 9:02 pm

I have re-run the CMake build to see what the settings that I had built Ogre with originally as I didn't make changes from the default settings I don't think (it was a while ago), and the Ogre_STATIC box is not ticked. Is that the cause of the warnings then, based on what you were saying before?
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Wed Jan 30, 2019 10:33 pm

that is my guess. i'd either update cmake and rebuild ogre (seems fast these days, or maybe it's my new-ish desktop?) or just add the OGREMAIN_STATIC_DEFINE to your ogremain.vcxproj.
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 11:01 pm

I decided to rebuild Ogre - I configured Ogre in cmake-gui, but when I tick the OGRE_STATIC box then reconfigure, I get this error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DirectX9_INCLUDE_DIR (ADVANCED)

There is no place for that directory that I can see. Any ideas what I'm doing wrong? I've built Ogre in the past, but presumably not with Ogre Static ticked or I'd have run into this error before
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Wed Jan 30, 2019 11:40 pm

Owl53 wrote:
Wed Jan 30, 2019 11:01 pm
I decided to rebuild Ogre - I configured Ogre in cmake-gui, but when I tick the OGRE_STATIC box then reconfigure, I get this error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DirectX9_INCLUDE_DIR (ADVANCED)

There is no place for that directory that I can see. Any ideas what I'm doing wrong? I've built Ogre in the past, but presumably not with Ogre Static ticked or I'd have run into this error before
The above error is only there when OGRE_STATIC is ticked, I started the process again without ticking that box and the error isn't there, which explains why I was able to build it previously. But given that I'm trying to use OGRE_STATIC to try and fix the issue with the hundreds of warnings, I'm at a loss to how to fix this CMake error. Any ideas?
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Thu Jan 31, 2019 1:29 am

is CMAKE finding your directx installation? i would check the output when you hit configure. have you installed directx 2010 sdk?
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 1:30 am

I should have posted the full error originally, so here it is. This is when OGRE_STATIC is ticked:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DirectX9_INCLUDE_DIR (ADVANCED)
used as include directory in directory ../ogre-1.11.5/ogre-1.11.5/Components/Bites
used as include directory in directory ../ogre-1.11.5/ogre-1.11.5/Components/Bites
used as include directory in directory ../ogre-1.11.5/ogre-1.11.5/Components/Bites
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 1:32 am

loath wrote:
Thu Jan 31, 2019 1:29 am
is CMAKE finding your directx installation? i would check the output when you hit configure. have you installed directx 2010 sdk?
I don't understand why it would only come up with an error with OGRE_STATIC if that was what the issue was. Nevertheless, I'll look into it to make sure. Thanks
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 8:50 am

Owl53 wrote:
Thu Jan 31, 2019 1:32 am
loath wrote:
Thu Jan 31, 2019 1:29 am
is CMAKE finding your directx installation? i would check the output when you hit configure. have you installed directx 2010 sdk?
I don't understand why it would only come up with an error with OGRE_STATIC if that was what the issue was. Nevertheless, I'll look into it to make sure. Thanks
Installing the SDK hasn't resolved the issue unfortunately, the error in cmake is still there when I restarted the process and hit configure again
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Thu Jan 31, 2019 6:28 pm

what does it mention about locating directx?

i just ran through this to upgrade to 1.11.5 (DLL version) and my configure says:
Looking for DirectX9...
Found DirectX9: C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/d3d9.lib
Looking for DirectX11...
Found DirectX11 headers: C:/Program Files (x86)/Windows Kits/8.1/Include/um
Found DirectX11: d3d11.lib;dxgi.lib;dxguid.lib
also, it appears the SDK creates an environment variable:
DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\

so make sure you've restarted cmake after installing the SDK or the process environment variable cache will be out of date. (or is DXSDK_DIR missing?)
Last edited by loath on Fri Feb 01, 2019 4:50 am, edited 1 time in total.
1 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 8:48 pm

loath wrote:
Thu Jan 31, 2019 6:28 pm
what does it mention about locating directx?

i just ran through this to upgrade to 1.11.5 (DLL version) and my configure says:
Looking for DirectX9...
Found DirectX9: C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/d3d9.lib
Looking for DirectX11...
Found DirectX11 headers: C:/Program Files (x86)/Windows Kits/8.1/Include/um
Found DirectX11: d3d11.lib;dxgi.lib;dxguid.lib
also, it appears the SDK creates an environment variable:
DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\

so make sure you've restarted cmake after installing the SDK or the processes environment variable cache will be out of date. (or is DXSDK_DIR missing?)
Thank you! It's now working! After having downloaded the SDK, I deleted the cache in cmake for the new attempted build, but I hadn't restarted cmake (I didn't think it needed it), so it still didn't work. After reading your message, I restarted cmake and tried again, and that fixed it!

Thanks for the help!
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 9:03 pm

I am now able to build OGRE with the OGRE_STATIC box ticked, so given the original focus of this thread I'll post an update when its ready regarding whether it is a solution for the DLL warnings, for those looking back at this thread if they have similar issues.
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Thu Jan 31, 2019 11:27 pm

Have really had trouble with the whole process of using OGRE_STATIC. I don't understand what I'm doing wrong that means it's throwing up so many errors at each stage of the process when compared to building without this option selected.

The cmake stage of the build process seemed to work correctly. So as specified in the Ogre 1.11 build guide, I then opened Ogre.sln. I built the ALL_BUILD project and everything seemed to build correctly. After that, I built the INSTALL project. This is where it errors. It comes up with the error MSB3073 - The command "setlocal"

Trying to provide as much information as possible, this is what is in the output log in VS:

Code: Select all

1>CMake Error at OgreMain/cmake_install.cmake:61 (file):
1>  file INSTALL cannot find "C:/Users/Name/Desktop/OgreStatic/lib/OgreMainStatic_d.pdb".
1>Call Stack (most recent call first):
1>  cmake_install.cmake:160 (include)

The command "setlocal"C:\Users\Name\Desktop\cmake-3.10.0-win64-x64\cmake-3.10.0-win64-x64\bin\cmake.exe"
 -DBUILD_TYPE=Debug -P cmake_install.cmakeif %errorlevel% neq 0 goto :cmEnd:cmEndendlocal
  & call :cmErrorLevel %errorlevel% 
  & goto :cmDone:cmErrorLevelexit /b %1:cmDoneif %errorlevel% neq 0 goto :VCEnd:VCEnd" exited with code 1.
Any suggestions as to what I'm doing wrong would be welcome.
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 144
Joined: Tue Jan 17, 2012 5:18 am
x 4

Re: Ogre DLL Warnings

Post by loath » Fri Feb 01, 2019 4:49 am

what two paths are you using to configure ogre's cmake?

for example, i unpack the ogre source into this directory:
d:\source\ogre3d\ogre-1.11.5

and i set my build directory to:
d:\source\ogre3d\ogre-1.11.5\build

after everything is compiled and i build 'install' it copies everything to:
d:\source\ogre3d\ogre-1.11.5\build\sdk
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Fri Feb 01, 2019 8:37 am

loath wrote:
Fri Feb 01, 2019 4:49 am
what two paths are you using to configure ogre's cmake?

for example, i unpack the ogre source into this directory:
d:\source\ogre3d\ogre-1.11.5

and i set my build directory to:
d:\source\ogre3d\ogre-1.11.5\build

after everything is compiled and i build 'install' it copies everything to:
d:\source\ogre3d\ogre-1.11.5\build\sdk
Unpacked the ogre source to this directory:

c:\users\name\desktop\SDKs\ogre-1.11.5

Set my build directory to:
c \users\name\desktop\SDKs\OgreStatic

After building install it copies everything to:
c:\users\name\desktop\SDKs\OgreStatic\sdk

I didn't change the CMAKE_INSTALL_PREFIX in cmake, it sets itself after I set the build directory.

When I look in the directory for that error: it's looking for the pdb, in OgreStatic\lib - but in that folder there is only another folder - debug - and in there is all the .libs but no pdbs

Is it a requirement that the build directory is within the source directory like yours is? As that is a definite difference compared to the directories I've used - wondering if that is what is causing the error
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Fri Feb 01, 2019 12:40 pm

Owl53 wrote:
Fri Feb 01, 2019 8:37 am
loath wrote:
Fri Feb 01, 2019 4:49 am
what two paths are you using to configure ogre's cmake?

for example, i unpack the ogre source into this directory:
d:\source\ogre3d\ogre-1.11.5

and i set my build directory to:
d:\source\ogre3d\ogre-1.11.5\build

after everything is compiled and i build 'install' it copies everything to:
d:\source\ogre3d\ogre-1.11.5\build\sdk
Unpacked the ogre source to this directory:

c:\users\name\desktop\SDKs\ogre-1.11.5

Set my build directory to:
c \users\name\desktop\SDKs\OgreStatic

After building install it copies everything to:
c:\users\name\desktop\SDKs\OgreStatic\sdk

I didn't change the CMAKE_INSTALL_PREFIX in cmake, it sets itself after I set the build directory.

When I look in the directory for that error: it's looking for the pdb, in OgreStatic\lib - but in that folder there is only another folder - debug - and in there is all the .libs but no pdbs

Is it a requirement that the build directory is within the source directory like yours is? As that is a definite difference compared to the directories I've used - wondering if that is what is causing the error
Quoting this for an easier reference. I just tried rebuilding with a different directory structure, creating a build folder in ogre-1.11.5, like you had done @Loath, but the install build still failed.

c:\users\name\desktop\SDKs\ogre-1.11.5

Set my build directory to:
c \users\name\desktop\SDKs\ogre-1.11.5\Build

After building install it copies everything to:
c:\users\name\desktop\SDKs\ogre-1.11.5\Build\sdk

But it failed with the same error again.
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Fri Feb 01, 2019 1:05 pm

Confusingly, I have looked in the CMakeError.txt in the folder CMakeFiles to try and find more information about the error, and it says

Code: Select all

fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory 
, which is a different issue to what it is saying in VS. Hopefully this can help shed some light on the situation

That is the first issue in the file, and following that it says build failed.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 923
Joined: Sun Mar 30, 2014 2:51 pm
x 209
Contact:

Re: Ogre DLL Warnings

Post by paroj » Fri Feb 01, 2019 3:46 pm

the static ogre build does not receive much testing. So there are probably also some errors in the generated OGREConfig.cmake
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Fri Feb 01, 2019 3:51 pm

paroj wrote:
Fri Feb 01, 2019 3:46 pm
the static ogre build does not receive much testing. So there are probably also some errors in the generated OGREConfig.cmake
I see. As I'm sure is clear from previous posts, I am very new to using cmake, so I don't have the required knowledge of it to find out if there are any errors in it. Do you know what is causing the issue explained in the original post by any chance? As I'm trying to build the static ogre simply to try and stop the dll warnings
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 923
Joined: Sun Mar 30, 2014 2:51 pm
x 209
Contact:

Re: Ogre DLL Warnings

Post by paroj » Fri Feb 01, 2019 3:55 pm

yeah.. we are not properly propagating the ogre dependencies through cmakeconfig:
https://cmake.org/cmake/help/v3.13/manu ... ation-file

any pull-requests fixing this are welcome.
0 x

Owl53
Halfling
Posts: 89
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Ogre DLL Warnings

Post by Owl53 » Fri Feb 01, 2019 4:00 pm

paroj wrote:
Fri Feb 01, 2019 3:55 pm
yeah.. we are not properly propagating the ogre dependencies through cmakeconfig:
https://cmake.org/cmake/help/v3.13/manu ... ation-file

any pull-requests fixing this are welcome.
I think there might be a slight misunderstanding of what I was referring to, my message was probably a little vague.
Visual Studio is giving a huge number (hundreds) of warnings (C2451) such as:
'Ogre::TextureManager::mWarningTexture': class 'Ogre::SharedPtr<Ogre::Texture>' needs to have dll-interface to be used by clients of class 'Ogre::TextureManager'

Upon searching for other threads of this type on the forums, a common factor seems to be that people are building their projects as a DLL. I'm not doing that, the project is built as an application, so I'm at a bit of a loss to explain why I'm getting all these warnings. Any suggestions would be welcome.
This is the issue that I was referring to. I am literally getting hundreds of these warnings (not using Ogre static), and I don't understand why.

As for solving the Ogre Static Cmake issues, if I had a good enough knowledge of cmake to know how to fix the problem with it, I would happily submit a PR, but I don't unfortunately yet.
0 x

Post Reply