Ogre DLL Warnings
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Ogre DLL Warnings
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
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
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
check OgreExports.h which should define the dll exports to empty when static:
is OGREMAIN_STATIC_DEFINE set for you?
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
I've checked the OgreExports.h in the include directory that I've linked to my project, here is the following code: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
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
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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?
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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?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
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
is CMAKE finding your directx installation? i would check the output when you hit configure. have you installed directx 2010 sdk?
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
what does it mention about locating directx?
i just ran through this to upgrade to 1.11.5 (DLL version) and my configure says:
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?)
i just ran through this to upgrade to 1.11.5 (DLL version) and my configure says:
also, it appears the SDK creates an environment variable: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
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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!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:
also, it appears the SDK creates an environment variable: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
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?)
Thanks for the help!
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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:
Any suggestions as to what I'm doing wrong would be welcome.
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.
-
- Platinum Sponsor
- Posts: 290
- Joined: Tue Jan 17, 2012 5:18 am
- x 67
Re: Ogre DLL Warnings
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
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
Unpacked the ogre source to this directory: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
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
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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.Owl53 wrote: ↑Fri Feb 01, 2019 8:37 amUnpacked the ogre source to this directory: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
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
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.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
Confusingly, I have looked in the CMakeError.txt in the folder CMakeFiles to try and find more information about the error, and it says
, 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.
Code: Select all
fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
That is the first issue in the file, and following that it says build failed.
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: Ogre DLL Warnings
the static ogre build does not receive much testing. So there are probably also some errors in the generated OGREConfig.cmake
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
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
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: Ogre DLL Warnings
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.
https://cmake.org/cmake/help/v3.13/manu ... ation-file
any pull-requests fixing this are welcome.
-
- Halfling
- Posts: 92
- Joined: Sat Jul 22, 2017 2:32 pm
- x 4
Re: Ogre DLL Warnings
I think there might be a slight misunderstanding of what I was referring to, my message was probably a little vague.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.
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.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.
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.