SFML community forums
Help => System => Topic started by: KraXarN 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 (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!
-
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
-
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?
-
What's your code?
-
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");
-
And where's the implementation of the function?
-
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
-
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 (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.
-
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
-
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.
-
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...
-
Any C++ book/resource that talk about classes. You may even Google what the difference is between class definition (aka implementation) and class declaration.