nfsu / NFS

Is a tool created for rom hacking, it stands for Nintendo File System (Utils) and can quickly read and interpret nds files such as NARC, NCLR, NCGR, etc.
MIT License
25 stars 1 forks source link

Compilation error, no matching function for call to std::exception::exception(const char [53]) #6

Closed 0xJes closed 6 years ago

0xJes commented 6 years ago

This line:

nfs::NARC &narc = fs.get<nfs::NARC>(*fs["fielddata/eventdata/zone_event.narc"]);

Causes this compile error:

In file included from include/filesystem.h:2,
                 from src/main.cpp:3:
include/archive.h: In instantiation of 'T& nfs::Archive::get(nfs::ArchiveObject&) [with T = nfs::GenericResource<1129464142, nfs::BTAF, nfs::BTNF, nfs::GMIF>]':
include/filesystem.h:107:28:   required from 'T& nfs::FileSystem::get(nfs::ArchiveObject&) [with T = nfs::GenericResource<1129464142, nfs::BTAF, nfs::BTNF, nfs::GMIF>]'
include/filesystem.h:102:33:   required from 'T& nfs::FileSystem::get(nfs::FileSystemObject&) [with T = nfs::GenericResource<1129464142, nfs::BTAF, nfs::BTNF, nfs::GMIF>]'
src/main.cpp:13:80:   required from here
include/archive.h:67:15: error: no matching function for call to 'std::exception::exception(const char [53])'
    throw std::exception("Archive Couldn't cast; variables aren't of same type");
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8.1.1/exception:38,
                 from /usr/include/c++/8.1.1/stdexcept:38,
                 from /usr/include/c++/8.1.1/array:39,
                 from include/generic.h:2,
                 from include/templatemagic.h:2,
                 from include/genericresource.h:2,
                 from include/ntypes.h:2,
                 from include/resourcehelper.h:2,
                 from include/archive.h:2,
                 from include/filesystem.h:2,
                 from src/main.cpp:3:
/usr/include/c++/8.1.1/bits/exception.h:63:5: note: candidate: 'std::exception::exception()'
     exception() _GLIBCXX_USE_NOEXCEPT { }
     ^~~~~~~~~
/usr/include/c++/8.1.1/bits/exception.h:63:5: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/8.1.1/bits/exception.h:60:9: note: candidate: 'constexpr std::exception::exception(const std::exception&)'
   class exception
         ^~~~~~~~~
/usr/include/c++/8.1.1/bits/exception.h:60:9: note:   no known conversion for argument 1 from 'const char [53]' to 'const std::exception&'

changing std::exception for std::runtime_error by example, fixes the error. i am in linux and using gcc 8.1.1

Nielsbishere commented 6 years ago

Are you pulling from the NFS reloaded branch? that one is the proper branch, the main branch didn't work on Linux and anything other than Windows x64 Debug.

0xJes commented 6 years ago

Yes, i'm pulling from NFS_Reloaded branch.

Nielsbishere commented 6 years ago

I thought I fixed that error already, guess not. Thanks

Nielsbishere commented 6 years ago

This was already fixed? https://github.com/Nielsbishere/NFS/blob/NFS_Reloaded/nfs/include/generic.h

0xJes commented 6 years ago

There is still a call to std::exception in filesystem.h and archive.h, not using the EXCEPTION macro.

Nielsbishere commented 6 years ago

It's done, thanks. I really hate how MSVC has so many incompatible features; std::exception(std::string) isn't supported almost anywhere else.