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

Author Topic: SFML with CodeBlocks problem  (Read 3791 times)

0 Members and 1 Guest are viewing this topic.

kuhkoa

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML with CodeBlocks problem
« on: June 25, 2011, 11:42:00 pm »
I followed the instructions in the tutorial and I can't get the sample program to compile.

Code: [Select]
||=== sfml, Debug ===|
obj\Debug\main.o||In function `main':|
C:\Users\PieCrust\Documents\Computer Science Stuff\Blocks\sfml\main.cpp|6|undefined reference to `sf::Clock::Clock()'|
C:\Users\PieCrust\Documents\Computer Science Stuff\Blocks\sfml\main.cpp|9|undefined reference to `sf::Clock::GetElapsedTime() const'|
C:\Users\PieCrust\Documents\Computer Science Stuff\Blocks\sfml\main.cpp|10|undefined reference to `sf::Sleep(float)'|
C:\Users\PieCrust\Documents\Computer Science Stuff\Blocks\sfml\main.cpp|7|undefined reference to `sf::Clock::GetElapsedTime() const'|
||=== Build finished: 4 errors, 0 warnings ===|


So I guess it can't find the classes.. but I'm not sure how to fix it.

Thanks in advanced. =]

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
SFML with CodeBlocks problem
« Reply #1 on: June 26, 2011, 12:59:06 am »
You need to link to the library.

See this page:

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

Scroll down to the "Compiling your first SFML program".  Note the steps after the code snippit.  Do those.

kuhkoa

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML with CodeBlocks problem
« Reply #2 on: June 26, 2011, 01:55:33 am »
I downloaded the SDK and built all four configurations (Debug, Release, Static, and DLL) without any reported errors and I ran the batch file and it's still not working. =[

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
SFML with CodeBlocks problem
« Reply #3 on: June 26, 2011, 02:17:58 am »
That's because you need to link to the library.   =P

See this page:

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

Scroll down to the "Compiling your first SFML program". Note the steps after the code snippit. Do those.

kuhkoa

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML with CodeBlocks problem
« Reply #4 on: June 27, 2011, 06:25:02 am »
It compiles now, but I'm getting this error:

Code: [Select]
The program can't start because sfml-system.dll is missing from your computer. Try reinstalling the program to fix this problem.

I looked and that file is present... =/ Sorry for all the trouble.

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
SFML with CodeBlocks problem
« Reply #5 on: June 27, 2011, 06:49:06 am »
Probably have to compile SFML.  Try this (from same page):

Quote
a batch script named build.bat exists in SFML-x.y\build\codeblocks\batch-build. This script automatically compiles the SFML libraries for all configurations (debug/release static/dynamic) and performs the extra step required for static libraries. All you have to do before running it is to make your Code::Blocks executable (codeblocks.exe) available, i.e. add its path to the PATH environment variable.


Find that batch file and run it.  It should produce the dlls you need.


Quote
Sorry for all the trouble.


No need to apologize.  It's hard starting out.  We've all been there.

kuhkoa

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML with CodeBlocks problem
« Reply #6 on: June 27, 2011, 08:56:12 pm »
I've run the batch file a few times now, but I just noticed that I get a bunch of errors while running it.. that's probably why it's not working.

Quote

Compiling sfml-main...
'codeblocks' is not recognized as an internal or external command, operable program, or batch file.

.
.
.
Compiling debug static libraries...
'codeblocks' is not recognized as an internal or external command, operable program, or batch file.

.
.
.
Compiling debug dynamic libraries...
'codeblocks' is not recognized as an internal or external command, operable program, or batch file.

.
.
.
Compiling release static libraries...
'codeblocks' is not recognized as an internal or external command, operable program, or batch file.

.
.
.
Compiling release dynamic libraries...
'codeblocks' is not recognized as an internal or external command, operable program, or batch file.

.
.
.
5 Files copied
5 Files copied
Adding external libraries to libsfml-window-s...
Adding external libraries to libsfml-graphic-s...
Adding external libraries to libsfml-audio-s...
Adding external libraries to libsfml-network-s...
Cleaning up...
10 Files copied
The process cannot access the file because it is being used by another process.
Done.
 


I bolded the problems.

Thank you so much!

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
SFML with CodeBlocks problem
« Reply #7 on: June 28, 2011, 05:19:15 am »
You need to add whatever directory Code Blocks is in to your %PATH% environment variable.

How to do this though, I'm not entirely sure.  Maybe someone else can fill in the blanks.

Xander314

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://sfmlcoder.wordpress.com/
    • Email
SFML with CodeBlocks problem
« Reply #8 on: June 28, 2011, 08:22:30 am »
This error:
Quote
The program can't start because sfml-system.dll is missing from your computer. Try reinstalling the program to fix this problem.

is because the SFML DLLs have to be in your project directory :)

(There is somewhere else you can put them, but that's never worked for me)

EDIT: As for PATH, go to Start and right click Computer. Click Advanced System Settings on the left, then in the resultant window click Environment Variables. Finally, in the bottom pane, scroll down until you see an entry named Path and double click it. In the resultant window, scroll to the end of the entry, make sure there is a semicolon after the previous path and then add your Code::Blocks installation directory (don't put it in quotes).

 

anything