Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: vc2010 dll file corrupt?  (Read 4908 times)

0 Members and 1 Guest are viewing this topic.

revix2k9

  • Newbie
  • *
  • Posts: 6
    • View Profile
vc2010 dll file corrupt?
« on: February 12, 2011, 07:43:46 am »
I am trying to just run basic tutorial code with window up. i got it to work since then i got a bunch of linker errors i followed a lot guides i got the linker error to go away now i get this.

Code: [Select]
1>C:\SFML\lib\sfml-window-d.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x308


and this is my code
Code: [Select]
///////////////////////////////////////////////////////////
//AdventureRPG Quest Game V0.0.0
//By revix2k9
///////////////////////////////////////////////////////////
#include <iostream>
#include <SFML/Graphics.hpp>
#include "Title.cpp"

#pragma comment(lib, "sfml-system-d.lib")
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-graphics-d.lib")

int main ()
{

//Renderds window
sf::RenderWindow Game(sf::VideoMode(800,600,32) ,"AdventureRPGQuest");
//Setup Event handle
sf::Event Event;
// clears the screen
Game.Clear();
// dispalys the screen
Game.Display();


while (Game.IsOpened())
{

while(Game.GetEvent(Event))
{
//window closed
if (Event.Type == sf::Event::Closed)
{
Game.Close();
//escape key pressed
if (Event.Type == sf::Event::KeyPressed && (Event.Key.Code == sf::Key::Escape))
Game.Close();
}
}

}
return EXIT_SUCCESS;
}


I linked the sfml-window-d.lib file to linker input and include the .dll of the files as well. and i included graphics too.

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
vc2010 dll file corrupt?
« Reply #1 on: February 12, 2011, 09:51:59 am »
You shouldn't include the DLLs as library inputs - the lib files take care of that. You just have to make sure the DLLs are in the same directory as the executable (or rather, your working directory - which by default would be your project directory.)

Also,

#include "title.cpp" is not really how you usually handle multiple cpp files - add them to the project instead.

revix2k9

  • Newbie
  • *
  • Posts: 6
    • View Profile
vc2010 dll file corrupt?
« Reply #2 on: February 12, 2011, 05:35:07 pm »
yeah i am beginner with C++ thanks for the tip.

revix2k9

  • Newbie
  • *
  • Posts: 6
    • View Profile
vc2010 dll file corrupt?
« Reply #3 on: February 13, 2011, 04:51:36 am »
ok i took off the dll files i listed on linker-> input then i put the dll files in my debug directory now i get this.

Code: [Select]
Unhandled exception at 0x00639caf in AdventureRPGQuest.exe: 0xC0000005: Access violation reading location 0x3f80000c.

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
vc2010 dll file corrupt?
« Reply #4 on: February 13, 2011, 09:32:46 am »
The debugger doesn't use the debug-directory as its default working directory unless you tell it to.

Start by putting the dll's in the project directory (i.e:  mygame/ instead of mygame/debug/)

Also, make sure you're using the proper libraries/dll's, something like this:

Code: [Select]
#if defined(_DEBUG)
#pragma comment(lib, "sfml-system-d.lib")
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-graphics-d.lib")
#else
#pragma comment(lib, "sfml-system.lib")
#pragma comment(lib, "sfml-window.lib")
#pragma comment(lib, "sfml-graphics.lib")
#endif


Also, you're need to include "sfml-main.lib" to use main instead of winmain, unless your project is a console app.

revix2k9

  • Newbie
  • *
  • Posts: 6
    • View Profile
vc2010 dll file corrupt?
« Reply #5 on: February 13, 2011, 06:45:37 pm »
Quote from: "devlin"
The debugger doesn't use the debug-directory as its default working directory unless you tell it to.

Start by putting the dll's in the project directory (i.e:  mygame/ instead of mygame/debug/)

Also, make sure you're using the proper libraries/dll's, something like this:

Code: [Select]
#if defined(_DEBUG)
#pragma comment(lib, "sfml-system-d.lib")
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-graphics-d.lib")
#else
#pragma comment(lib, "sfml-system.lib")
#pragma comment(lib, "sfml-window.lib")
#pragma comment(lib, "sfml-graphics.lib")
#endif


Also, you're need to include "sfml-main.lib" to use main instead of winmain, unless your project is a console app.

k thx , i fixed it runs now what i did was i decleared Game.clear(); in begin before Game.display();

 

anything