Trying to build Box2d as /MD

1)- set the project dependencies so you app depends on the Box2D project?
😕 How would i do that?

2)-remove the box2d.lib from you linker options?

should box2d_d.lib still be in my linker list? if i remove box2d.lib but keep box2d_d.lib, there is no changes. If i remove both box2d.lib and box2d_d.lib then i get the following errors:

Quote:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall b2World::~b2World(void)" (??1b2World@@QAE@XZ) referenced in function _SDL_main main.obj
Error 2 error LNK2019: unresolved external symbol "public: void __thiscall b2World::Step(float,int)" (?Step@b2World@@QAEXMH@Z) referenced in function _SDL_main main.obj
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall b2Body::SetOriginPosition(struct b2Vec2 const &,float)" (?SetOriginPosition@b2Body@@QAEXABUb2Vec2@@M@Z) referenced in function _SDL_main main.obj
Error 4 error LNK2019: unresolved external symbol "public: struct b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAUb2Body@@PBUb2BodyDef@@@Z) referenced in function _SDL_main main.obj
Error 5 error LNK2019: unresolved external symbol "public: __thiscall b2World::b2World(struct b2AABB const &,struct b2Vec2 const &,bool)" (??0b2World@@QAE@ABUb2AABB@@ABUb2Vec2@@_N@Z) referenced in function _SDL_main main.obj
Error 6 fatal error LNK1120: 5 unresolved externals C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\sdl physics\Release\sdl physics.exe



3) - make sure all projects are using the same C lib option (/MT)?
All projects uses (/MD).
Goto the menu: Project -> Project Dependencies ...

Make you app's project depend on the Box2D project.

If you do this, you don't need to have any Box2D library in the linker line. If you look at Box2D.sln, you can see that the TestBed project depends on Box2D, freeglut, and GLUI.

I suggest learning more about using Visual C++ before tackling a complex project. Perhaps this will get you started:
http://en.wikipedia.org/wiki/Visual_C++
http://www.amazon.com/s/ref=nb_ss_gw/104-1586884-5711947?url=search-alias%3Daps&field-keywords=visual+C%2B%2B
Thanks for your advice! i will surely look deeper into my IDE after this project 🙂.

I tried doing what you said, and clicked Box2d in Project Dependencies in my project, however the error is still there..
Quote:
Error 1 error LNK2019: unresolved external symbol "public: struct b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAUb2Body@@PBUb2BodyDef@@@Z) referenced in function _SDL_main main.obj
Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\sdl physics\Release\sdl physics.exe


Thanks for your big effort in trying to help me 🙂 it is greatly appreciated!
I have just spend the whole day trying to figure out why this isn't working, and i still hasn't solved the problem :'(. I have Searched all over the net, and tried everything possible. Me who thought my game was finished 🙁 I couldn't have been more wrong.

In the box2d solution, only the HelloWorld program seems to run when i change everything to /MD and RELEASE mode. I do not know if it is related, but the testbed gives me a

"This application has failed to start because MSVCP80D.dll was not found."
error.


Quote:
Error 3 error LNK2019: unresolved external symbol "public: struct b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAUb2Body@@PBUb2BodyDef@@@Z) referenced in function _SDL_main main.obj
Error 4 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe



I am officially desperate 😳
Just to be clear, your problems have nothing to do with Box2D.

First you need to copy all the DLLs from
Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT
into your application's project directory or the Windows\system32 directory.

Also you need the application to generate a manifest: go to the linker options : Manifest File : Generate Manifest : Yes

It still seems that your are not linking with Box2D. You should look at the linker line in your application's BuildLog.htm
-It seems i have no such folder called 'redist', or any sub folders named 'x86' in my IDE folder at:

C:\Programmer\Microsoft Visual Studio 8\VC

screen shot from my (rather messy) folder:
http://img262.imageshack.us/my.php?image=ssvcfolderyi2.jpg

My 'program files' folder is almost empty, but has nothing related to any IDE.

I have the EE of MSVC++ 8, if that makes any difference.

-My project is already building a manifest file.

-The buildlog.htm:
Quote:
Build Log


Build started: Project: Gense sump, Configuration: Release|Win32

Command Lines


Creating temporary file "c:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Gense sump\Release\RSP00000122724296.rsp" with contents
[
/O2 /FD /EHsc /MD /Fo"Release\\" /Fd"Release\vc80.pdb" /c /TP ".\main.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Gense sump\Release\RSP00000122724296.rsp" /nologo /errorReport:prompt"
Creating temporary file "c:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Gense sump\Release\RSP00000222724296.rsp" with contents
[
/OUT:"C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe" /MANIFEST /MANIFESTFILE:"Release\Gense sump.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib sdlgfx.lib sdl_ttf.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 msimg32.lib winmm.lib "..\..\..\..\box2d_v1.4.32211\box2d_v1.4.3\box2d\library\box2d.lib"

".\Release\main.obj"
]
Creating command line "link.exe @"c:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Gense sump\Release\RSP00000222724296.rsp" /NOLOGO /ERRORREPORT:PROMPT"

Output Window


Compiling...
main.cpp
.\main.cpp(282) : warning C4996: 'sprintf' was declared deprecated
C:\Programmer\Microsoft Visual Studio 8\VC\include\stdio.h(345) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
.\main.cpp(423) : warning C4996: 'sprintf' was declared deprecated
C:\Programmer\Microsoft Visual Studio 8\VC\include\stdio.h(345) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
Linking...
main.obj : error LNK2019: unresolved external symbol "public: struct b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAUb2Body@@PBUb2BodyDef@@@Z) referenced in function _SDL_main
C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe : fatal error LNK1120: 1 unresolved externals

Results


Build log was saved at "file://c:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Gense sump\Release\BuildLog.htm"
Gense sump - 2 error(s), 2 warning(s)



the line i think you are talking about is this:
/OUT:"C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe" /MANIFEST /MANIFESTFILE:"Release\Gense sump.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib sdlgfx.lib sdl_ttf.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 msimg32.lib winmm.lib "..\..\..\..\box2d_v1.4.32211\box2d_v1.4.3\box2d\library\box2d.lib"
Well you'll have to get the missing DLLs from somewhere.

This line: "..\..\..\..\box2d_v1.4.32211\box2d_v1.4.3\box2d\library\box2d.lib"

I wonder if the linker is having trouble finding this file.
-Well, it only produces the missing MSVCP80D.dll error in the testbed, not in my game project.

-I tried copying the box2d project into my game project folder and the linker line in the log file now look like this:

/OUT:"C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe" /MANIFEST /MANIFESTFILE:"Release\Gense sump.exe.intermediate.manifest" /SUBSYSTEM:WINDOWS SDL.lib SDLmain.lib SDL_image.lib SDL_mixer.lib sdlgfx.lib sdl_ttf.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 msimg32.lib winmm.lib ".\box2d_v1.4.32211\box2d_v1.4.3\box2d\library\box2d.lib"

So i think the compiler can find it.

EDIT:
i tried downloading the missing file, and the testbed now gives me the following error:
http://img266.imageshack.us/my.php?image=errorerrorjp1.jpg
followed by:
http://img145.imageshack.us/my.php?image=errorerror11ry5.jpg
followed by:
"Unhandled exception at 0x7c964ed1 in TestBed.exe: 0xC0000142: DLL Initialization Failed."
followed by:
"No symbols are loaded for any call stack frame. The source code cannot be displayed."


The HelloWorld project works fine..
I see that the testbed project uses subsystem CONSOLE, in my game project i am using subsystem WINDOWS, if that makes any difference.
You need to generate a Manifest in the linker stage.
Alright! the testbed is working now, however my game project is still producing the same god damn error!
Quote:
Error 1 error LNK2019: unresolved external symbol "public: struct b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAUb2Body@@PBUb2BodyDef@@@Z) referenced in function _SDL_main main.obj
Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\mads\Dokumenter\Visual Studio 2005\Projects\Gense sump\Release\Gense sump.exe

Original thread: https://box2d.org/forum/viewtopic.php?t=156