Fatal error: cannot open file 'optimized.lib'

Problems building or running the engine, queries about how to use features etc.
Post Reply
vojta
Gnoblar
Posts: 1
Joined: Fri Apr 27, 2018 9:58 pm
x 1

Fatal error: cannot open file 'optimized.lib'

Post by vojta » Fri Apr 27, 2018 10:22 pm

Hi, I'm getting following error when I'm building ALL_BUILD in the Visual Studio:

Code: Select all

11>------ Rebuild All started: Project: Codec_FreeImage, Configuration: Debug Win32 ------
11>OgreFreeImageCodec.cpp
3>OgreOverlayManager.cpp
11>LINK : fatal error LNK1104: cannot open file 'optimized.lib'
11>Done building project "Codec_FreeImage.vcxproj" -- FAILED.
Prior building OGRE I built OGREDEPS, then I added it's 'ogredeps/build/ogredeps' directory to OGRE_DEPENDENCIES_DIR parameter of cmake-gui. I'm using MS Visual Studio Community 2017 version 15.3.5 and Windows 7 64-bit. Please advise and be patient with me as I'm only a student :-) Thanks in advance!
1 x

Pellaeon
Halfling
Posts: 89
Joined: Thu Apr 28, 2011 12:23 pm
x 3

Re: Fatal error: cannot open file 'optimized.lib'

Post by Pellaeon » Mon May 07, 2018 8:34 am

I have the same issue. On my old projects I had the Dependecies directory in the main folder. With Ogre 1.11.0 the cmake projects downloads the dependecies. In principle a handy solution, But it seems there are some small remained problems.

At first, in Debug mode of the OgreMain project the path to zzlib.lib is wrong (in release mode it's right). This can be fixed easily with adjusting the path in the project options. of VS.
And second there is this missing "optimized.lib". I also not found the file :?
1 x

Pellaeon
Halfling
Posts: 89
Joined: Thu Apr 28, 2011 12:23 pm
x 3

Re: Fatal error: cannot open file 'optimized.lib'

Post by Pellaeon » Mon May 07, 2018 8:51 am

OK, the optimzed-lib stuff is unnecessary. Only delete the reference, check the path to teh FreeImageLib and then it works

e.g. these are my libaries in the Codec_FreeImage prjects
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
..\..\lib\Debug\OgreMain_d.lib
D:\libraries\cpp\FreeImage\FreeImage 3.17.0\v141\Win32\Debug\FreeImageLib.lib
1 x

rodrimanu360
Gnoblar
Posts: 1
Joined: Thu Sep 13, 2018 9:45 pm
x 1

Re: Fatal error: cannot open file 'optimized.lib'

Post by rodrimanu360 » Thu Sep 13, 2018 9:48 pm

How do you delete the reference to the optimized.lib? I'm trying to modify the dependencies from the linker on the properties page of the project on visual Studio, but i cant find the linker option to do it.

Thanks
1 x

glennr
Greenskin
Posts: 109
Joined: Thu Jun 05, 2008 3:26 am
Location: Thames, New Zealand
x 3

Re: Fatal error: cannot open file 'optimized.lib'

Post by glennr » Wed Jan 23, 2019 5:53 am

This is caused by quotes around ${FreeImage_LIBRARIES} in PlugIns\FreeImageCodec\CMakeLists.txt

Rather than edit the generated VS files, the fix is to remove the quotes:

Code: Select all

...
  add_definitions(-DFREEIMAGE_LIB)
   add_library(Codec_FreeImage ${OGRE_LIB_TYPE} ${HEADER_FILES} ${SOURCES})
 - target_link_libraries(Codec_FreeImage PUBLIC OgreMain "${FreeImage_LIBRARIES}")
 + target_link_libraries(Codec_FreeImage PUBLIC OgreMain ${FreeImage_LIBRARIES})
   target_include_directories(Codec_FreeImage PUBLIC 
       "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
       $<INSTALL_INTERFACE:include/OGRE/Plugins/FreeImageCodec>
....
2 x

User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 1
Contact:

Re: Fatal error: cannot open file 'optimized.lib'

Post by mmixLinus » Thu Jan 24, 2019 12:54 pm

This is caused by quotes around ${FreeImage_LIBRARIES} in PlugIns\FreeImageCodec\CMakeLists.txt
Thanks for this glennr, and paroj for getting this fixed (issue #1063)!

I have now run into a similar problem in Components\Overlay\CMakeLists.txt:24.

Code: Select all

target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE "${FREETYPE_LIBRARIES}" ZLIB::ZLIB)
0 x
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook

Post Reply