Hi,
Well, this is not a project made for me, i'm trying to adapt him to decode a game, i deleted the file osdep.h, i did not know how to adapt the file osdep.h to windows and thought it was not important ... but in linux operating properly. The creator does not offer support.
File osdep.h original
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <string>
inamespace os{
inline std::string get_home_dir() {
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
return std::string(homedir);
}
}
|
File osdep.h changed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
/*#include <X11/Xlib.h> // XInitThreads
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <string>
namespace os{
inline std::string get_home_dir() {
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
return std::string(homedir);
}
}*/
|
File lodepng.cpp
https://gitorious.org/cc94/cc94/source/9f326bfb598c0a36631c306e16159f380c2d606e:src/lodepng/lodepng.h#L5
1 2 3 4 5 6 7 8 9 10 11 12
|
void save_png(Path const& filename, Image & image, uint width, uint height, bool overwrite=false)
{
bool exist = boost::filesystem::exists(filename);
if (overwrite or !exist) {
unsigned error = lodepng::encode(filename.c_str(), reinterpret_cast<uint8 const*>(&image.data[0]), width, height);
if (error) {
throw Error("lodepng encoder error %||: $||", error, lodepng_error_text(error));
}
}
}
|
Well, if i change the conversion to string, that part compiles but does not understand why it works on linux and xp no.
1 2 3 4 5 6 7 8 9 10 11 12
|
void save_png(Path const& filename, Image & image, uint width, uint height, bool overwrite=false)
{
bool exist = boost::filesystem::exists(filename);
if (overwrite or !exist) {
unsigned error = lodepng::encode(filename.string(), reinterpret_cast<uint8 const*>(&image.data[0]), width, height);
if (error) {
throw Error("lodepng encoder error %||: $||", error, lodepng_error_text(error));
}
}
}
|
P.D. Now I get an error on line std::ifstream f((dir/"pal.PAL"));
1 2 3 4 5 6 7 8 9 10 11 12 13
|
Pallete get_default_pallete(Path const& fname) {
auto dname = get_dname("pal.PAL");
auto dir = fname.parent_path();
std::ifstream f((dir/"pal.PAL"));
ifbuf wr(f);
//imbuf wr2(read_buf(wr, 256*3));
return read_pallete(wr, dname);
}
|
**** Build of configuration Default for project cc94-cc94 ****
**** Internal Builder is used for build ****
**** WARNING: The "Default" Configuration may not build ****
**** because it uses the "cdt.managedbuild.toolchain.gnu.mingw.base" ****
**** tool-chain that is unsupported on this system. ****
**** Attempting to build... ****
g++ -std=c++11 -IC:\cc94-cc94\inc -IC:\cc94-cc94\src\lodepng -IC:\Sofware\SFML-2.2\include\SFML -O2 -g -Wall -c -fmessage-length=0 -osrc\unmadspack.o ..\src\unmadspack.cpp
..\src\unmadspack.cpp: In function 'std::vector<std::vector<unsigned char> > get_descomprimir(ifbuf&)':
..\src\unmadspack.cpp:360:8: warning: unused variable 'hash_' [-Wunused-variable]
auto hash_ = read_uint16(read<2>(iheader));
^
..\src\unmadspack.cpp: In function 'Pallete get_default_pallete(const Path&)':
..\src\unmadspack.cpp:454:33: error: no matching function for call to 'std::basic_ifstream<char>::basic_ifstream(boost::filesystem::path)'
std::ifstream f((dir/"pal.PAL"));
^
..\src\unmadspack.cpp:454:33: note: candidates are:
In file included from ..\src\unmadspack.cpp:3:0:
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:486:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::basic_string<char>; std::ios_base::openmode = std::_Ios_Openmode]
basic_ifstream(const std::string& __s,
^
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:486:7: note: no known conversion for argument 1 from 'boost::filesystem::path' to 'const string& {aka const std::basic_string<char>&}'
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:470:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
^
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:470:7: note: no known conversion for argument 1 from 'boost::filesystem::path' to 'const char*'
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:456:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits<char>]
basic_ifstream() : __istream_type(), _M_filebuf()
^
C:/Archivos de programa/mingw-w64/i686-4.9.2-posix-dwarf-rt_v3-rev1/mingw32/i686-w64-mingw32/include/c++/fstream:456:7: note: candidate expects 0 arguments, 1 provided
Build error occurred, build is stopped
Time consumed: 3000 ms.
Greetings.