LINK : fatal error LNK1104: cannot open file 'OgreMain.lib'

Problems building or running the engine, queries about how to use features etc.
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

LINK : fatal error LNK1104: cannot open file 'OgreMain.lib'

Post by Vantage »

Using Visual Studio .NET 2003, DirectX 9.0c SDK and Azeroth, I get the following error when compiling the totorial;

http://www.ogre3d.org/docs/Tutorials/Se ... tings.html

Any clues.. i'm still looking into it. The link above wasn't correct for me, I had to add an extra path to the libs to find Ogre.h to get past that problem, but now I have something else as you can see below.

The search gave me a whole bunch of similar problems but nothing that I could actually use to fix the problem.

OgreMain.lib is not in any directory unpacked by Azeroth or the dependencies. MMORPG was just the dir I created under samples, so just don't read too much into it please.
Build Log ------- Build started: Project: MMORPG, Configuration: Debug|Win32 -------

Command Lines Creating temporary file "g:\Development\Ogre\Samples\Mmorpg\Debug\RSP00000C.rsp" with contents
[
/OUT:"..\Common\Bin\Debug\mmorpg.EXE" /INCREMENTAL /NOLOGO /LIBPATH:"..\..\OgreMain\Lib\Debug" /DEBUG /PDB:"Debug/MMORPG.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 OgreMain.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
.\debug\mmorpg.obj
]
Creating command line "link.exe @g:\Development\Ogre\Samples\Mmorpg\Debug\RSP00000C.rsp"
Output Window Linking...
LINK : fatal error LNK1104: cannot open file 'OgreMain.lib'
Results Build log was saved at "file://g:\Development\Ogre\Samples\Mmorpg\Debug\BuildLog.htm"
MMORPG - 1 error(s), 0 warning(s)
User avatar
AnimalMachine
Gnoblar
Posts: 19
Joined: Sun Jan 19, 2003 4:36 pm
Location: Milwaukee, WI USA

Post by AnimalMachine »

1) In a debug build, link to OgreMain_d.lib instead.

2) Make sure "..\..\OgreMain\Lib\Debug" is the right relative path from your project file to access that directory.

That should clear that error up.
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

Post by Vantage »

Don't have that file either :(
User avatar
AnimalMachine
Gnoblar
Posts: 19
Joined: Sun Jan 19, 2003 4:36 pm
Location: Milwaukee, WI USA

Post by AnimalMachine »

Did you do a batch build of everything in Ogre.sln yet?
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

Post by Vantage »

Yah, loads of errors when I did it.. and this is straight out of the box as it were, sigh..

I'm trying, but fumbling along atm.. thanks for the help so far.
Lodes
Google Summer of Code Student
Google Summer of Code Student
Posts: 228
Joined: Mon Mar 17, 2003 12:02 am
Location: San Jose, CA, USA

Post by Lodes »

did you download the dependencies. There is no reason at all why any builds in ogre.sln to fail, if you've got the dependencies and directx9 sdk.
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

Post by Vantage »

yes, i have the dependencies. just some conversions going on atm in thre batch build. It's taken 2 hours so far with 1223 errors
Last edited by Vantage on Sun Feb 13, 2005 12:52 am, edited 1 time in total.
Lodes
Google Summer of Code Student
Google Summer of Code Student
Posts: 228
Joined: Mon Mar 17, 2003 12:02 am
Location: San Jose, CA, USA

Post by Lodes »

This is very long, way too long. With a clean copy of ogre when you first open ogre.sln, you convert the project files to vc 2003 by just pressing yes. It should do that in under 10 seconds max. Then just batch build.

Your situation looks very weird to me.
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

Post by Vantage »

The convert was very quick, but the batch build is taking hours.. so many erros shown at the bottom of the screen. It never did complete.

I just did it again, fresh install of VS.NET2003, clean download of Ogre and Dependencies, and same result after following the tutorial.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Load the solution but only build OgreMain debug. Then show us the errors you get.
team-pantheon programmer
creators of Rastullahs Lockenpracht
HS2000
Gnoblar
Posts: 1
Joined: Sun Feb 13, 2005 6:30 pm

Post by HS2000 »

I think I have the same problem...
I take all the tutorial tell me to do, but still have the fatal error:can't not open the file zzip.h and can't not find OgreMain.lib,OgreMain_d.lib
anyone who know what problem with me???help!!!
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Please, people - if you're new to Ogre, start with building the main distribution and it's samples, don't leap into your own project straight away. Ogre does (batch) build out of the box if you follow the instructions properly.

HS2000: you didn't build Ogre yet or your library paths are not set up right. If zzip.h is missing when you try to build Ogre, you didn't install the dependencies, or you installed them incorrectly. Extract them in ogrenew.

Those who are a little rusty on how to set up a build environment or diagnose compiler errors might be better to wait for the SDK release, which I hope to make as newbie friendly as possible.
Vantage
Gnoblar
Posts: 12
Joined: Fri Feb 11, 2005 1:48 pm

Post by Vantage »

This is what I did;

Install Visual Studio.NET 2003
Download Ogre 1.0.0
Download Dependencies
Download DirectX 9c SDK
Install DirectX 9c SDK
Unpack Ogre 1.0.0 to d:\Ogrenew
Unpack dependencies to d:\Ogrenew
Open VC.NET 2003
Say YES to convert to VC.NET 2003
Go to Batch build and build release and debug.
Sit for 2 hours and watch 1k+ errors come up on the screen.

What am I doing wrong. This is supposed to work from what I have read in the tutorial and the readme.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

tanis wrote:Load the solution but only build OgreMain debug. Then show us the errors you get.
Don't just tell us you get errors. Show them!. We can't mind read.
The error message you showed in your first post isn't really helpful for it only says that Ogremian.dll has not been built.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Unpack Ogre 1.0.0 to d:\Ogrenew
Unpack dependencies to d:\Ogrenew
I think that's your problem. You should unpack the 1.0.0 archive and see that it includes an 'ogrenew' folder. Therefore you should extract the dependencies into the ogrenew folder created by extracting the original archive. As it is, you're going to have 2 levels of 'ogrenew'.
EGD Eric
Halfling
Posts: 41
Joined: Mon Dec 13, 2004 4:07 pm
Location: St. Bruno, Quebec, Canada

Post by EGD Eric »

I am also having the same exact problem as Vantage and HS2000. I can't find any dependencies to download anywhere on the site.

I'm curious: Why doesn't the "Ogrenew" folder we get start with a dependencies folder inside it in the first place?


Edit: Scratch that, I found the dependencies. On the main page, no less. Its just that I did a search for dependencies on the downloads section and got no results.

How long's this supposed to take? Its been batch building for 10 minutes now. No errors yet though. lots of stupid warnings though: "cannot convert from size_t to int" get a clue VC++! I usually disable this one with:

#pragma warning(disable: ERROR_NUMBER)
EGD Eric
Halfling
Posts: 41
Joined: Mon Dec 13, 2004 4:07 pm
Location: St. Bruno, Quebec, Canada

Post by EGD Eric »

Ok, now its finally finished the batch build. No errors, but I don't see any newly built OgreMain.lib or OgreMain_d.lib anywhere. I tried copying an old sample from the old "OgreNew" (previous version of Ogre), and running it in the samples folder of the new Ogre, and I get this error:

Space error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup

I'm guessing CRT means "check runtime". What does that mean? better yet, what can I do to make it go away? This is the code that may be causing the trouble:

Code: Select all

#if OGRE_PLATFORM == PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"


INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
    // Create application object
    SpaceApplication app;

    try {
        app.go();
    } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == PLATFORM_WIN32
        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL );
#else
        std::cerr << "An exception has occured: " <<
            e.getFullDescription().c_str() << std::endl;
#endif
    }

    return 0;
}
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

CRT means C runtime-time library. Anyway: Don't ever mix code from different versions of Ogre, when you don't exactly know what you're doing. And frankly this isn't the case here. ;) This is bound to make trouble.

When there weren't any errors and you are sure you did a batch build, then OgreMain.lib is created. Look for it in ogrenew/OgreMain/lib/(debug|release). If it isn't there, you did something wrong.

Don't try to fix your ogrenew directory. check it out anew (or unzip it anew) and follow the instructions.
team-pantheon programmer
creators of Rastullahs Lockenpracht
EGD Eric
Halfling
Posts: 41
Joined: Mon Dec 13, 2004 4:07 pm
Location: St. Bruno, Quebec, Canada

Post by EGD Eric »

when you don't exactly know what you're doing. And frankly this isn't the case here
You mean this IS the case here. :)

The instructions? I followed them: Download the latest version of Ogre: It has an OgreNew directory. I put it somewhere on my computer, then downloaded the dependencies from the front page of the site and stuck those in the directory. Then, I did a batch build of Ogre.sln. What more is there to do?
Look for it in ogrenew/OgreMain/lib/(debug|release).
Oh, ok I was looking in the wrong place then. Its there! I no longer get the error of "can't find the lib" anymore, just that CRT crap. It is frustrating though, that it just doesn't work.
Don't ever mix code from different versions of Ogre
Its the 2nd tutorial. What am I supposed to do with any other projects I have started from a previous version of ogre? Start all over?

I can't complain because its free, but they should mention this "building the libraries" step in the first tutorial.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

What am I supposed to do with any other projects I have started from a previous version of ogre? Start all over?
Well, as with any c-library based project, you'll need to recompile them against the new versions of the libraries.
...but they should mention this "building the libraries" step in the first tutorial
Given that it's a source distribution (currently) I think it's pretty much taken as read that you've got to build it before you start going through the tutorials.

Building the core libraries is the third thing in the Ogre Readme.
EGD Eric
Halfling
Posts: 41
Joined: Mon Dec 13, 2004 4:07 pm
Location: St. Bruno, Quebec, Canada

Post by EGD Eric »

I don't want to start an argument, but "make a batch build of all the projects" isn't super-obvious. A clearer thing to say would be this: "Go into the Ogrenew folder. See that project called: Ogre.sln? (and .dsw)If you're using .net, go into the .sln one, then perform a batch build. This will build the libraries: OgreMain.lib and OgreMain_d.lib in the OgreMain\lib\Release and OgreMain\lib\Debug folders...."

If it were really obvious, there wouldn't be so many people having the same "can't find OgreMain_d.lib" problem.
Well, as with any c-library based project, you'll need to recompile them against the new versions of the libraries.
I don't understand. What do you mean? I hit the "build" button. Isn't that recompiling?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

No, it's an incremental build, it won't recompile anything that's already been built. If you've been around C/C++ compilers a while you'll get used to the fact that sometimes they screw up, and think they can get away with an incremental build when actually they need a completely clean build. In terms of VC that's either Batch Build > Select All > Clean followed by Batch Build > Select All > Build, or alternatively just Batch Build > Select All > Rebuild.

You'll have to forgive the terseness here but Ogre is a complex beast and we expect people to be familiar with their development tools before coming here. Otherwise it's kinda like trying to learn to drive in a Ferrari F40 ;) Remember, this is a source release. I'm going to try to make the final precompiled SDK release more newbie-friendly, but it is a much larger drain on our project resources to provide pre-packaged SDKs for every compiler variant so we've delayed it until the final 1.0.0 release.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I don't want to start an argument...
It's not an argument, it's just a healthy discussion!
:)
but "make a batch build of all the projects" isn't super-obvious. A clearer thing to say would be this: "Go into the Ogrenew folder. See that project called: Ogre.sln...
Well, the docs do say;
4. Open either Ogre.dsw (VC6) or Ogre.sln (VC7+)
....
6. Perform a Batch Build for all the projects.
Unfortunately Ogre is currently (although not for long!) a "pre-release" source only distribution and, given that it's a pretty hardcore C++ library, it assumes that the developers using it have a certain amount of expertise with the development environment they're using and of working with large multi-project builds. I think most of the "I can't build it" problems stem from a lack of this knowledge. I know for a fact that I didn't have anything like the knowledge of MSVC I do now when I first started working with Ogre, but I stumbled through and now I can't see how people could possibly have problems building it! Oh, how easily we forget!

I believe there are some more detailed build instructions in the Wiki, if you think they're not clear then I'm sure everyone would welcome any enhancements you'd like to make.

Be that as it may, after 1.0.0 is released there will be pre-compiled "SDK" releases available which will negate the need to compile the core libraries.

I daresay there'll still be a regular raft of "I can't compile my project against the Ogre SDK" problems though!
I don't understand. What do you mean? I hit the "build" button. Isn't that recompiling?
No. Do a "Rebuild", or better still do a "Clean" followed by a "Build".

[edit]Damn, sinbad beat me to it. That'll teach me to be so verbose![/edit]
EGD Eric
Halfling
Posts: 41
Joined: Mon Dec 13, 2004 4:07 pm
Location: St. Bruno, Quebec, Canada

Post by EGD Eric »

4. Open either Ogre.dsw (VC6) or Ogre.sln (VC7+)
....
6. Perform a Batch Build for all the projects.
Oh, ok, I didn't see that part. I ended up looking back at the "Humble beginnings" tutorial instead. But they could mention it there too. My mistake though.

Anyway, I did what the two of you said (Monster and Sinbad), and I'm still getting the stupid CRT error. So now I'm trying this with another project, and I'm not getting errors, instead I'm getting a "can't find dll" message when trying to run it. It can't find OgreMain_d.dll. How am I supposed to tell it to find that? I've never had a problem with dlls before. I've looked in the folder where OgreMain_d.lib is, and OgreMain_d.dll is right there with it.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I tried copying an old sample from the old "OgreNew" (previous version of Ogre), and running it in the samples folder of the new Ogre, and I get this error:

Space error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Right. For starters, that's a linker error, not a runtime error. So I think you're confused about the difference between compiling and running. What this error means is that you're linking a DOS program against the Windows libraries and so the standard Windows entry point isn't there.

Alternatively, you haven't read the Azathoth porting notes here;
http://ogrewiki.digitalsentience.com/in ... thothNotes
And so you haven't read this bit;
Important: All OGRE C++ macros have been prefixed with OGRE_ . This means that LITTLE_ENDIAN is now OGRE_LITTLE_ENDIAN and Except is now OGRE_EXCEPT. If you use LITTLE_ENDIAN or BIG_ENDIAN anywhere in your program you have to be very careful, as using the old macro name does compile but always evaluates to false.
And so you don't know that you shouldn't use

Code: Select all

#if OGRE_PLATFORM == PLATFORM_WIN32

you should use

Code: Select all

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

...instead I'm getting a "can't find dll" message when trying to run it...How am I supposed to tell it to find that?
Standard Windows procedure is that DLLs are found either in the working directory of the executable or on your PATH, as specified by the environment variable. So either put the folder with your Ogre DLLs in it on you PATH, or just copy your executable to the folder with OgreMain_d.dll and all the other Ogre DLLs in it, i.e. ogrenew/Samples/Common/bin/Debug
Post Reply