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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - remotesh

Pages: [1]
1
General / Re: Weird Cxx11 Undefined Error
« on: July 04, 2017, 07:25:26 am »
I was a dummy guys,

My make file wasn't hitting that particular file which was throwing me the error. This can be closed.

2
General / Weird Cxx11 Undefined Error
« on: July 02, 2017, 11:06:03 pm »
I'm using C++ with SFML libraries with VisualCode on Xubuntu with G++ as my compiler.
I installed the SFML library via the packages (libsfml-dev).

I have a basic texture Manager class.

    #ifndef TEXTUREMANAGER_HEADER
    #define TEXTUREMANAGER_HEADER
   
    #include <SFML/Graphics.hpp>
    #include <map>
    #include <string>
   
    class TextureManager {
       private:
          std::map<std::string, sf::Texture> _textures;
       public:
          void loadTexture(std::string, std::string);
          sf::Texture& getSpecificTexture(std::string);
   
          TextureManager()
          {
          }
    };
    #endif

That I call in another one of my class functions:

    void Test::loadTextures()
    {
        std::string text = "texture_brunette_girl";
        std::string loc  = "../sprites/brunette.png";
        _texmgr.loadTexture(text, loc);
    }

(_texmgr is just an initialized TextureManager object)

However I get this error message when I compile:

    test.o: In function `Test::loadTextures()':
    /dev/open-engined/./src/Test.cpp:32: undefined reference to `TextureManager::loadTexture(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    collect2: error: ld returned 1 exit status


I'm compiling with G++, here's my compile command for good measure:

    g++ -c -std=c++11 -Wall -g ./src/test.cpp
    g++ test.o -o open-engine -lsfml-graphics -lsfml-window -lsfml-system


I'm not sure why it's complaining about the undefined reference when I'm clearly calling that function with the correct data type. Googling and whatnot hasn't been much help.

Thanks in advance!

Pages: [1]
anything