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

Author Topic: File can be compiled through g++ in console, but not in codeblocks  (Read 978 times)

0 Members and 1 Guest are viewing this topic.

Christ00pher

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Hello, I have installed Codeblocks on my Debian Linux, I want to make a project with a bunch of files so using console g++ is pretty inconvenient.
I downloaded codeblocks and libsfml-dev through apt-get, however it doesn't seem to work properly.
After I try to compile sample code in codeblocks, I receive the message:
||=== Build: Debug in test_project (compiler: GNU GCC Compiler) ===|
ld||cannot find -lsfml-graphics-d|
ld||cannot find -lsfml-window-d|
ld||cannot find -lsfml-system-d|
||error: ld returned 1 exit status|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


In build options, the only 2 things I changed were putting SFML_STATIC to #defines and inserting sfml-graphics/window/system-d modules for debug and sfml-graphics/window/system for release mode.
My guess would be that the compiler simply doesn't see sfml's libraries. How am I able to tell the compiler where to look?
And if that's not the case, how can I solve this issue?

PS: Here's how I compile the code through terminal:
$ g++ -c main.cpp
$ g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system

I don't have to tell g++ any additional paths, so it seems that the sfml package was installed in default path, so shouldn't codeblocks compile it without any problem too?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: File can be compiled through g++ in console, but not in codeblocks
« Reply #1 on: December 14, 2017, 09:50:47 pm »
Ypu can't do something one way and thn do it differently the other way and expect it to work.

On Linux there are no debug libs provided by apt-get, thus the -d prefix is wrong.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Christ00pher

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: File can be compiled through g++ in console, but not in codeblocks
« Reply #2 on: December 14, 2017, 10:11:36 pm »
Oh... ok, deleted the suffix '-d' from debug mode and now everything works perfectly fine.
Thank you for your quick reply, appreciate it!

 

anything