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

Author Topic: InputStream issue  (Read 6644 times)

0 Members and 1 Guest are viewing this topic.

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
InputStream issue
« on: July 25, 2016, 06:35:29 pm »
Hello!

So, I want to load files from a zip file. I tried following the example from http://www.sfml-dev.org/documentation/2.3.2/classsf_1_1InputStream.php, but I ran into multiple issues. Firstly, Int64 isn't a thing, but that was probably because it was missing sf::Int64, but when compiling, I get this error now instead when attempting to call "ZipStream stream("data.zip")"
undefined reference to `ZipStream::ZipStream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
and
undefined reference to `vtable for ZipStream'
for the class

Thanks!
« Last Edit: July 25, 2016, 06:56:56 pm by KraXarN »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: InputStream issue
« Reply #1 on: July 25, 2016, 07:15:36 pm »
The ZipStream example is incomplete; so my guess is that you didn't implement it or you forgot to link your implementation file with the rest of your code.

EDIT: negation was missing
« Last Edit: July 25, 2016, 08:57:13 pm by Hiura »
SFML / OS X developer

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
Re: InputStream issue
« Reply #2 on: July 25, 2016, 07:23:26 pm »
The ZipStream example is incomplete; so my guess is that you did implement it or you forgot to link your implementation file with the rest of your code.

I also tried following the tutorial on user data streams, but it doesn't explain much more. I included the file where the class is, do I need to do more?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: InputStream issue
« Reply #3 on: July 25, 2016, 08:06:54 pm »
What's your code?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
Re: InputStream issue
« Reply #4 on: July 25, 2016, 10:41:06 pm »
What's your code?

Just straight from the example pretty much

class ZipStream : public sf::InputStream
{
    public:
        ZipStream(string archive);
        bool openFile(string archive);
        bool open(string filename);
        sf::Int64 read(void* data, sf::Int64 size);
        sf::Int64 seek(sf::Int64 position);
        sf::Int64 tell();
        sf::Int64 getSize();
};

And then I call it from my main cpp file with

ZipStream stream("data.zip");

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: InputStream issue
« Reply #5 on: July 25, 2016, 10:57:26 pm »
And where's the implementation of the function?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
Re: InputStream issue
« Reply #6 on: July 26, 2016, 02:49:29 am »
And where's the implementation of the function?

What do you mean? Where I have that code? That code is in the main cpp file outside of main and call it inside of the main

Hapax

  • Hero Member
  • *****
  • Posts: 3346
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: InputStream issue
« Reply #7 on: July 26, 2016, 02:57:42 am »
And where's the implementation of the function?
That code is in the main cpp file outside of main
Can you show this implementation?

I tried following the example from http://www.sfml-dev.org/documentation/2.3.2/classsf_1_1InputStream.php
[...]
Firstly, Int64 isn't a thing, but that was probably because it was missing sf::Int64
This documentation should be updated to use the full sf::Int64 typename as external implementations will be not be inside the sf namespace.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
Re: InputStream issue
« Reply #8 on: July 26, 2016, 03:08:57 am »
And where's the implementation of the function?
That code is in the main cpp file outside of main
Can you show this implementation?

The code I have is the code I posted before

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: InputStream issue
« Reply #9 on: July 26, 2016, 08:21:54 am »
Please, don't take this the wrong way, but you clearly need to review your C++ bases... If you don't know what an implementation is from a definition, you will not go anywhere. :-/

Take the time to learn how C++ really works before starting using libraries, especially if they require you to have advanced knowledge.
SFML / OS X developer

KraXarN

  • Newbie
  • *
  • Posts: 12
  • Stuffs and things
    • View Profile
Re: InputStream issue
« Reply #10 on: July 28, 2016, 06:34:44 pm »
Please, don't take this the wrong way, but you clearly need to review your C++ bases... If you don't know what an implementation is from a definition, you will not go anywhere. :-/

Take the time to learn how C++ really works before starting using libraries, especially if they require you to have advanced knowledge.

I'm fairly new to C++ so, but I can't find any sort of information of where I can read more about this...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
AW: InputStream issue
« Reply #11 on: July 28, 2016, 06:58:53 pm »
Any C++ book/resource that talk about classes. You may even Google what the difference is between class definition (aka implementation) and class declaration.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/