SFML community forums

Help => General => Topic started by: NameUser on June 05, 2012, 10:04:51 pm

Title: Errors On Compilation
Post by: NameUser on June 05, 2012, 10:04:51 pm
I recently changed computers. I managed to reinstall SFML, but I'm getting an error on compilation. I'm relatively new, so I'm not quite sure as to the cause.

The program was simply a test that everything was set up right, it does nothing but open a window. I'm thinking the problem likely lies not in the code but in the project setup, but I'll include the code regardless.

http://pastebin.com/q8QzPQan

Using Visual Studio 2011 Beta.
Title: Re: Errors On Compilation
Post by: Laurent on June 05, 2012, 10:56:04 pm
You must link to the sfml-window library.
Title: Re: Errors On Compilation
Post by: NameUser on June 05, 2012, 11:20:08 pm
SFML-window-d.lib is in Linker->Input->Additional Dependencies. Is that what you're reffering to?
Title: Re: Errors On Compilation
Post by: Laurent on June 06, 2012, 08:18:53 am
Yes, that's what I meant.

Ok, so make sure that SFML_STATIC is not defined in your preprocessor options.
Title: Re: Errors On Compilation
Post by: NameUser on June 06, 2012, 06:35:15 pm
Oh? I thought it was supposed to be?

Regardless, removing it results in 10 unresolved conflicts, as opposed to 6.
Title: Re: Errors On Compilation
Post by: Laurent on June 06, 2012, 06:49:43 pm
Quote
Oh? I thought it was supposed to be?
It is required if you link to static libraries (-s suffix), which you apparently don't ("SFML-window-d.lib").

Quote
removing it results in 10 unresolved conflicts
Which ones?
Title: Re: Errors On Compilation
Post by: NameUser on June 06, 2012, 11:40:10 pm
http://pastebin.com/pQmnsUz1
Title: Re: Errors On Compilation
Post by: Laurent on June 07, 2012, 07:39:14 am
Can you upload your project file?
Title: Re: Errors On Compilation
Post by: NameUser on June 08, 2012, 05:14:45 am
http://www.sendspace.com/file/z616a7
Title: Re: Errors On Compilation
Post by: NameUser on June 11, 2012, 12:28:58 am
Could I please get some help here?
Title: Re: Errors On Compilation
Post by: NameUser on June 13, 2012, 04:02:33 am
I hate to be  nag, but I could really use some help here.
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 13, 2012, 03:48:13 pm
Your project file is so messed up I don't even want to try to explain what you have to put where...

Create a completly new project and follow STRICTLY the tutorial (http://sfml-dev.org/tutorials/2.0/start-vc.php). ;)
Title: Re: Errors On Compilation
Post by: NameUser on June 13, 2012, 10:19:46 pm
1>sfml-graphics-d.lib(sfml-graphics-d-2.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

That's the new error. Obviously some type of bit conflict, but I'm not sure why. I don't remember defining anything as specifically being 64 or 32 bit.

I am running a 64 Bit Windows 7 and using 64 bit VS.
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 14, 2012, 01:01:31 am
I am running a 64 Bit Windows 7 and using 64 bit VS.

There's no 64bit Visual Studio ;D

So again you didn't follow strictily the tutorial, because you somehow managed to change the platform from 32 to 64bit.

Unfortunatly there's no 64bit version of SFML 2rc directly available to download. So I guess you should keep using the 32bit version and switching your platform back to 32 (or you get the source from GitHub and compile the library on your own...). ;)
Title: Re: Errors On Compilation
Post by: NameUser on June 15, 2012, 04:27:36 am
So again you didn't follow strictily the tutorial

I did. Whatever's broken is a default.

So I guess you should keep using the 32bit version and switching your platform back to 32
Mind informing me how I do this?
Title: Re: Errors On Compilation
Post by: Laurent on June 15, 2012, 07:58:55 am
Quote
I did. Whatever's broken is a default
You shouldn't blindly rely on SFML tutorials. I wrote them so that the forum is not spammed with beginners questions, but the truth is that one should know its tools before using a library. There are probably more complete tutorials around the internet that would help you understand Visual Studio.
Title: Re: Errors On Compilation
Post by: NameUser on June 15, 2012, 04:12:22 pm
Quote
I did. Whatever's broken is a default
You shouldn't blindly rely on SFML tutorials. I wrote them so that the forum is not spammed with beginners questions, but the truth is that one should know its tools before using a library. There are probably more complete tutorials around the internet that would help you understand Visual Studio.

You have to understand I'm getting conflicting directions now. Gonna take yours though seeing as you made the bloody thing.

I've used VS a fair bit, I've just never had to worry about changing the bit version before, because I previously had a 32 bit system.

If you could please just tell me how to fix this, I really am itching to get back to learning and practicing.
Title: Re: Errors On Compilation
Post by: Laurent on June 15, 2012, 04:43:36 pm
You should start by telling us what you did. At the beginning of this thread you had linker errors and then suddenly it's a platform issue.

--> how did you solve the linker errors, and what did you do to trigger this 64-bits error?
Title: Re: Errors On Compilation
Post by: NameUser on June 15, 2012, 04:57:59 pm
I started a new project and followed it strictly off of that tutorial exploiter linked. It was pretty similar to what I did the first time. I can tell there were a few differences but I don't remember exactly what.

I got the platform errors when I finished following that and plugged in the code to test it that the tutorial gives.
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 16, 2012, 10:45:26 am
Mind informing me how I do this?

I guess some googling would have answered you that question but... ::)

On the top of VS there should be a dropdown box with "Debug" (or "Release") written, next to that one there's another dropdown box with "x64"  (or "Win32") written in it. If there's "x64" then you're compiling for 64bit CPUs and you can change that by selecting "Configuration-Manager" (or similar) in the dropdown box, then a dialogbox will open, there you choose from the top right dropdown box <New...> and on the next window choose in the uppper dropdown box "Win32".
Title: Re: Errors On Compilation
Post by: NameUser on June 16, 2012, 05:52:01 pm
I tried googling first, it's too vague of a search. I get a million results about visual studio and bit types, but none really all that helpful.

Also, that's not the problem. It's already Win32. The problem is that the "module machine type" is x64. How would I change THAT?
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 16, 2012, 06:25:15 pm
Also, that's not the problem. It's already Win32. The problem is that the "module machine type" is x64. How would I change THAT?

Project->Settings->Linker->Advanced->Target machine or similar. ;)
Title: Re: Errors On Compilation
Post by: NameUser on June 16, 2012, 07:50:03 pm
Already set to x86 :|

Edit: Now here's something curious. Setting it to x64 causes the error to reverse.

Debug\main.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

How does that make any sense at all?
Title: Re: Errors On Compilation
Post by: Laurent on June 16, 2012, 08:11:15 pm
Don't forget to "rebuild all" after such modifications.
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 16, 2012, 09:05:12 pm
What Laurent said and you're sure you created a completly new project and didn't add stuff to the old one?

Quote
Debug\main.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
This makes actually sense since your main.obj got compiled nonetheless as x86 and now confilicts with the target machine x64.
Title: Re: Errors On Compilation
Post by: NameUser on June 16, 2012, 09:36:39 pm
A friend helped me out with this. The error was in the compilation of SFML. I accidently compiled it as 64-bit, which led to this large variety of issues.


Regardless, thanks for all the help. One final question, could anyone link me to a safe download of MSVCR100.dll?

Thanks. :P
Title: Re: Errors On Compilation
Post by: Laurent on June 16, 2012, 09:57:50 pm
Did you ever tell us that you recompiled SFML yourself? We even spoke about the 32-bit precompiled RC, and you said nothing. I think we wasted many posts in this thread... >:(

Quote
One final question, could anyone link me to a safe download of MSVCR100.dll?
Here is what your users are supposed to install:
http://www.microsoft.com/en-us/download/details.aspx?id=5555
Title: Re: Errors On Compilation
Post by: eXpl0it3r on June 16, 2012, 10:28:43 pm
A friend helped me out with this. The error was in the compilation of SFML. I accidently compiled it as 64-bit, which led to this large variety of issues.

Did you ever tell us that you recompiled SFML yourself? We even spoke about the 32-bit precompiled RC, and you said nothing. I think we wasted many posts in this thread... >:(

Such things really piss me off sometimes.  >:(
Title: Re: Errors On Compilation
Post by: NameUser on June 16, 2012, 10:50:43 pm
Did you ever tell us that you recompiled SFML yourself? We even spoke about the 32-bit precompiled RC, and you said nothing. I think we wasted many posts in this thread... >:(

Quote
One final question, could anyone link me to a safe download of MSVCR100.dll?
Here is what your users are supposed to install:
http://www.microsoft.com/en-us/download/details.aspx?id=5555
Frankly I never even realized there was a precompiled version.  :-\

When you spoke of a 32-Bit RC I assumed it was expected that I recompiled. Apologies.

Quote
One final question, could anyone link me to a safe download of MSVCR100.dll?
Here is what your users are supposed to install:
http://www.microsoft.com/en-us/download/details.aspx?id=5555
That's not why I asked. I get an error whenever I try and test a program due to lack of that. Attempting to install that offers to repair or remove it. Repair doesn't help at all. Which brings me to my original question.

And now I need MSVCR100D.dll actually.


EDIT:

Through a lot of pain and suffering, I finally have it working. Thanks for all the help. This can be closed now.