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

Author Topic: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64  (Read 13728 times)

0 Members and 1 Guest are viewing this topic.

ZiggyCoded

  • Newbie
  • *
  • Posts: 3
    • View Profile
Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« on: September 15, 2013, 02:24:48 pm »
Hello folks, I'm having trouble trying to get SFML working. I'm on Win7 64bit using Code::Blocks 12.11 with Mingw compiler (x64-4.8.1-release-win32-sjlj-rev3). The problem:

Build messages:

Quote
||=== SFML Test, Debug ===|
ld.exe||cannot find -lsfml-graphics-d|
ld.exe||cannot find -lsfml-window-d|
ld.exe||cannot find -lsfml-system-d|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 2 seconds) ===|

Build Log:

Quote
-------------- Build: Debug in SFML Test (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -L..\..\Libraries\SFML-2.1\lib  -o "bin\Debug\SFML Test.exe" obj\Debug\src\main.o    -lsfml-graphics-d -lsfml-window-d -lsfml-system-d  -mwindows
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib\libsfml-graphics-d.a when searching for -lsfml-graphics-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-graphics-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-window-d.a when searching for -lsfml-window-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib\libsfml-window-d.a when searching for -lsfml-window-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-window-d.a when searching for -lsfml-window-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-window-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-system-d.a when searching for -lsfml-system-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib\libsfml-system-d.a when searching for -lsfml-system-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\Libraries\SFML-2.1\lib/libsfml-system-d.a when searching for -lsfml-system-d
c:/c++/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-system-d
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)
3 errors, 0 warnings (0 minutes, 2 seconds)
 

I will try to list everything to help diagnose the problem. I started out here:

http://www.sfml-dev.org/tutorials/2.1/start-cb.php

I followed it to a t.

I set the include / lib paths globally as stated, then linked as stated. As they said not to include .a or lib prefix, and by the looks of it they simply typed the name in (rather the clicking the actual file in the file browser), so I typed the correct ones.

Build options>Linker settings>Link libraries

Release:

sfml-graphics
sfml-window
sfml-system

Debug:

sfml-graphics-d
sfml-window-d
sfml-system-d

Everything in the screenshots matches mine exactly. I'm linking dynamically.

The version I downloaded was GCC 4.7 TDM (SJLJ) - 32 bits. My compiler is properly installed I believe as I've used it perfectly for console applications and C++11 for some time. When I got Code::Blocks I had to get Mingw seperatly (if I recall, because I was on 64bit), not a Code::Blocks supplied one. The Mingw download zip was named x64-4.8.1-release-win32-sjlj-rev3, which I believe is SJLJ and matches the SFML download.

This is what my "Global Compiler Settings" look like:



I hope that was thorough enough, can somebody please help? :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #1 on: September 15, 2013, 02:35:20 pm »
It seems like your compiling for 64 bits, so you should use the 64 bits SFML libraries.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #2 on: September 15, 2013, 05:00:50 pm »
It seems like your compiling for 64 bits, so you should use the 64 bits SFML libraries.
Or rather since he's using a different compiler than there are official binaries for, compiler SFML on your own.
If you'd have chosen POSIX as threading stuff, you could use my Nightly Builds.

As a side note, since you choose Win32 threading, you won't be able to use std::thread. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ZiggyCoded

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #3 on: September 16, 2013, 01:49:13 am »
It seems like your compiling for 64 bits, so you should use the 64 bits SFML libraries.

You lost me here. I downloaded Mingw 64 for Code::Blocks as I thought thats what I need because I'm on Win7 64bit?

I'm by no means a C++ expert and am still learning. I thought if I was compiling for 64 bits, I would've chose SFML 64bit. On this page:

http://www.sfml-dev.org/download/sfml/2.1/

I chose "GCC 4.7 TDM (SJLJ) - 32 bits". I'm compiling with Mingw, specific release "x64-4.8.1-release-win32-sjlj-rev3" (the zip folder was named that).
« Last Edit: September 16, 2013, 01:53:27 am by ZiggyCoded »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #4 on: September 16, 2013, 02:17:11 am »
I guess you should go google the meaning of "64bit". You can/do run 32bit applications on your 64bit system as well (e.g. open the task manager and look at all the processes that 32 bits in brackets at the end).

On Windows all the generated binaries of C++ libraries with MinGW compilers are not compatible from one version of the compiler to the other (afaik). So you can't go and use the official binaries that were compiled for the MinGW GCC 4.7 TDM SJLJ x64 compiler and try to use it with the MinGW Builds GCC 4.8.1 Win32 SJLJ r3 x64 compiler.

Thus in order to use SFML, you have to recompile SFML on your own for your compiler. I've done this for the MinGW Builds GCC 4.8.1 POSIX SEH r5 x64 and provide the binaries as Nightly Builds (among other compilers). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ZiggyCoded

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #5 on: September 16, 2013, 02:32:59 am »
I got it working (even made the circle blue  :D), I downloaded the "GCC 4.7 TDM (SJLJ) - 64 bits" version. Is this still bad though, given that says GCC 4.7 and my MinGW is GCC 4.8.1. Is the general idea then that I should always rebuild libraries to be up-to-date with any compiler I have?

I'm aware of 32bits being able to run on 64bit, I just always assumed I had to download Mingw in 64bit because my OS is 64. So, if I'm not mistaken, I could actually download MinGW in 32bit format instead (and probably should?). When that tutorial said we should use 32 bit versions (unless we have a good reason to use 64), I thought that only applied to any libraries we download, so should my compiler too be 32bit - even if I'm compiling on Win7 64 bit? Sorry if I sound stupid.

So many bits, so little time...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Cannot compile (Code::Blocks 12.11 / Mingw) Win7 64
« Reply #6 on: September 16, 2013, 02:57:51 am »
I got it working (even made the circle blue  :D) [...] Is this still bad though, given that says GCC 4.7 and my MinGW is GCC 4.8.1. Is the general idea then that I should always rebuild libraries to be up-to-date with any compiler I have?
Well it might "work" until you run into some explainable errors and issues. Then again I don't have enough knowledge on the compatibility stuff, to state that you should always rebuild, but if you want to be on the "safe" side, you should yes.

I'm aware of 32bits being able to run on 64bit, I just always assumed I had to download Mingw in 64bit because my OS is 64. So, if I'm not mistaken, I could actually download MinGW in 32bit format instead (and probably should?). When that tutorial said we should use 32 bit versions (unless we have a good reason to use 64), I thought that only applied to any libraries we download, so should my compiler too be 32bit - even if I'm compiling on Win7 64 bit? Sorry if I sound stupid.
Compilers which build native 32bit applications are always in 32bit and ones that build native 64bit applications are always in 64bit. There are however options to compile for a different architecture which is then called cross-compiling. (afaik) But since a 64bit system also support 32bit applications, there's not fixed compiler set, but you decide which architecture you want to use for your applications.
The fact that 32bit application get suggested is mostly because there might always be some PCs that don't have 64bit hardware and wouldn't be able to run your x64 applications. So it largely depends on your target audience. So in theory you can use whatever you'd like. Around 75% of steam users seem to be using x64 systems.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything