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

Author Topic: Weird linking error on Fedora [not on any other linux I've tried] (Solved)  (Read 7157 times)

0 Members and 2 Guests are viewing this topic.

foxhunter12

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Weird linking error on Fedora [not on any other linux I've tried]
« Reply #15 on: March 25, 2016, 02:45:52 am »
#include <SFML/Graphics.hpp>

int main()
{
    sf::Texture tex;
    tex.loadFromFile("some-image.png");
}

That's what it looks like in all files; here's it from Tree.cpp

if(!texture.loadFromFile("src/assets/images/entities/tree1.png")){
    cout << "Failed to load src/assets/images/entities/tree1.png" << endl;
}
if(!shadowTexture.loadFromFile("src/assets/images/entities/treetop1.png")){
    cout << "Failed to load src/assets/images/entities/treetop1.png" << endl;
}

foxhunter12

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Weird linking error on Fedora [not on any other linux I've tried]
« Reply #16 on: March 25, 2016, 06:32:09 pm »
Fixed!! After I fixed the bug from Weapon.cpp, I just had to delete the .o files and compiling and running worked. Weird how it gave me the error with sf::Texture::LoadFromFile. Thanks for all the help @FRex

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
There is something wrong with your makefile then. You shouldn't need to delete outdated files yourself. You rely on .o files for linking, not on the targets that build these .o files so these targets can't replace outdated .o files to link the app. Maybe you should have src/ in names of the .o targets too?
Back to C++ gamedev with SFML in May 2023

foxhunter12

  • Newbie
  • *
  • Posts: 15
    • View Profile
There is something wrong with your makefile then. You shouldn't need to delete outdated files yourself. You rely on .o files for linking, not on the targets that build these .o files so these targets can't replace outdated .o files to link the app. Maybe you should have src/ in names of the .o targets too?

I actually made my makefile a lot better and yes, i added src/ in the .o targets as well. It seems to work everytime without fail now since I have updated my game a little since fixing. Thanks for the help! If there's anything else bugging out I'll post on another forum post.

 

anything