Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of errors when compiling for ANSI support #12

Open
winapiadmin opened this issue Sep 11, 2023 · 3 comments
Open

A lot of errors when compiling for ANSI support #12

winapiadmin opened this issue Sep 11, 2023 · 3 comments

Comments

@winapiadmin
Copy link

winapiadmin commented Sep 11, 2023

Pe/Pe.hpp:2052:13: warning: multi-character character constant [-Wmultichar]
     pdb70 = 'SDSR', // RSDS
             ^~~~~~
Pe/Pe.hpp:2053:13: warning: multi-character character constant [-Wmultichar]
     pdb20 = '01BN', // NB10
             ^~~~~~
In file included from main.cpp:40:0:
Pe/Pe.hpp:47:69: warning: 'nodiscard' attribute directive ignored [-Wattributes]
     [[nodiscard]] constexpr T&& forward(remove_reference_t<T>& arg) noexcept
                                                                     ^~~~~~~~
Pe/Pe.hpp:53:70: warning: 'nodiscard' attribute directive ignored [-Wattributes]
     [[nodiscard]] constexpr T&& forward(remove_reference_t<T>&& arg) noexcept
                                                                      ^~~~~~~~
Pe/Pe.hpp: In member function 'Pe::RelocType Pe::Reloc::type() const':
Pe/Pe.hpp:119:14: error: 'IMAGE_REL_BASED_DIR64' was not declared in this scope
         case IMAGE_REL_BASED_DIR64    : return RelocType::dir64;
              ^~~~~~~~~~~~~~~~~~~~~
Pe/Pe.hpp: At global scope:
Pe/Pe.hpp:274:31: error: 'IMAGE_DELAYLOAD_DESCRIPTOR' was not declared in this scope
 using DirDelayedImports = Dir<IMAGE_DELAYLOAD_DESCRIPTOR, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT>;
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
Pe/Pe.hpp:274:93: error: template argument 1 is invalid
 using DirDelayedImports = Dir<IMAGE_DELAYLOAD_DESCRIPTOR, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT>;
                                                                                             ^
Pe/Pe.hpp:316:34: error: unable to find numeric literal operator 'operator""ui16'
     static constexpr auto k_mz = 0x5A4Dui16; // MZ
                                  ^~~~~~~~~~
Pe/Pe.hpp:317:34: error: unable to find numeric literal operator 'operator""ui32'
     static constexpr auto k_pe = 0x00004550ui32; // "PE\0\0"
                                  ^~~~~~~~~~~~~~
In file included from main.cpp:40:0:
Pe/Pe.hpp:512:14: error: expected nested-name-specifier
     typename DirectoryDescriptor<DirType> directory() const noexcept
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pe/Pe.hpp:512:43: error: invalid declarator before 'directory'
     typename DirectoryDescriptor<DirType> directory() const noexcept
                                           ^~~~~~~~~
Pe/Pe.hpp: In member function 'const ImgImportByName* Pe::Imports<<anonymous> >::FunctionEntry::name() const':
Pe/Pe.hpp:803:75: error: expected '(' before '>' token
             return m_lib.pe().byRva<typename GenericTypes::ImgImportByName>(rva);
                                                                           ^
Pe/Pe.hpp: In member function 'const char* Pe::Imports<<anonymous> >::ModuleEntry::libName() const':
Pe/Pe.hpp:875:31: error: expected primary-expression before 'char'
             return m_pe.byRva<char>(m_descriptor->Name);
                               ^~~~
Pe/Pe.hpp:875:31: error: expected ';' before 'char'
Pe/Pe.hpp:875:35: error: expected unqualified-id before '>' token
             return m_pe.byRva<char>(m_descriptor->Name);
                                   ^
Pe/Pe.hpp: In member function 'const typename Pe::Types<arch>::ImportAddressTableEntry* Pe::Imports<<anonymous> >::ModuleEntry::importAddressTable() const':
Pe/Pe.hpp:881:76: error: expected '(' before '>' token
             return m_pe.byRva<typename Types<arch>::ImportAddressTableEntry>(m_descriptor->FirstThunk);
                                                                            ^
Pe/Pe.hpp: In member function 'const typename Pe::Types<arch>::ImportLookupTableEntry* Pe::Imports<<anonymous> >::ModuleEntry::importLookupTable() const':
Pe/Pe.hpp:887:75: error: expected '(' before '>' token
             return m_pe.byRva<typename Types<arch>::ImportLookupTableEntry>(m_descriptor->OriginalFirstThunk);
                                                                           ^
Pe/Pe.hpp: In member function 'Pe::DirectoryDescriptor<Pe::Dir<_IMAGE_IMPORT_DESCRIPTOR, 1u> > Pe::Imports<<anonymous> >::descriptor() const':
Pe/Pe.hpp:940:41: error: expected primary-expression before '>' token
         return m_pe.directory<DirImports>();
                                         ^
Pe/Pe.hpp:940:43: error: expected primary-expression before ')' token
         return m_pe.directory<DirImports>();
                                           ^
Pe/Pe.hpp: At global scope:
Pe/Pe.hpp:1063:24: error: 'DirDelayedImports' has not been declared
         const typename DirDelayedImports::Type* m_descriptor;
                        ^~~~~~~~~~~~~~~~~
Pe/Pe.hpp:1066:56: error: 'DirDelayedImports' has not been declared
         ModuleEntry(const Pe<arch>& pe, const typename DirDelayedImports::Type* const descriptor) noexcept
                                                        ^~~~~~~~~~~~~~~~~
Pe/Pe.hpp:1077:24: error: 'DirDelayedImports' has not been declared
         const typename DirDelayedImports::Type* descriptor() const noexcept
                        ^~~~~~~~~~~~~~~~~
Pe/Pe.hpp:1146:25: error: 'DirDelayedImports' was not declared in this scope
     DirectoryDescriptor<DirDelayedImports> descriptor() const noexcept
                         ^~~~~~~~~~~~~~~~~
Pe/Pe.hpp:1146:42: error: template argument 1 is invalid
     DirectoryDescriptor<DirDelayedImports> descriptor() const noexcept
                                          ^
Pe/Pe.hpp: In member function 'const ImgImportByName* Pe::DelayedImports<<anonymous> >::FunctionEntry::name() const':
Pe/Pe.hpp:1022:75: error: expected '(' before '>' token
             return m_lib.pe().byRva<typename GenericTypes::ImgImportByName>(rva);
                                                                           ^
Pe/Pe.hpp: In member function 'bool Pe::DelayedImports<<anonymous> >::ModuleEntry::valid() const':
Pe/Pe.hpp:1084:50: error: request for member 'DllNameRVA' in '((const Pe::DelayedImports<<anonymous> >::ModuleEntry*)this)->Pe::DelayedImports<<anonymous> >::ModuleEntry::m_descriptor->', which is of non-class type 'const int'
             return m_descriptor && m_descriptor->DllNameRVA;
                                                  ^~~~~~~~~~
Pe/Pe.hpp: In member function 'const char* Pe::DelayedImports<<anonymous> >::ModuleEntry::moduleName() const':
Pe/Pe.hpp:1089:31: error: expected primary-expression before 'char'
             return m_pe.byRva<char>(m_descriptor->DllNameRVA);
                               ^~~~
Pe/Pe.hpp:1089:31: error: expected ';' before 'char'
Pe/Pe.hpp:1089:35: error: expected unqualified-id before '>' token
             return m_pe.byRva<char>(m_descriptor->DllNameRVA);
                                   ^
Pe/Pe.hpp: In member function 'const typename Pe::Types<arch>::ImportAddressTableEntry* Pe::DelayedImports<<anonymous> >::ModuleEntry::importAddressTable() const':
Pe/Pe.hpp:1095:76: error: expected '(' before '>' token
             return m_pe.byRva<typename Types<arch>::ImportAddressTableEntry>(m_descriptor->ImportAddressTableRVA);
                                                                            ^
Pe/Pe.hpp:1095:92: error: request for member 'ImportAddressTableRVA' in '((const Pe::DelayedImports<<anonymous> >::ModuleEntry*)this)->Pe::DelayedImports<<anonymous> >::ModuleEntry::m_descriptor->', which is of non-class type 'const int'
             return m_pe.byRva<typename Types<arch>::ImportAddressTableEntry>(m_descriptor->ImportAddressTableRVA);
                                                                                            ^~~~~~~~~~~~~~~~~~~~~
Pe/Pe.hpp: In member function 'const typename Pe::Types<arch>::ImportNameTableEntry* Pe::DelayedImports<<anonymous> >::ModuleEntry::importNameTable() const':
Pe/Pe.hpp:1101:73: error: expected '(' before '>' token
             return m_pe.byRva<typename Types<arch>::ImportNameTableEntry>(m_descriptor->ImportNameTableRVA);
                                                                         ^
Pe/Pe.hpp:1101:89: error: request for member 'ImportNameTableRVA' in '((const Pe::DelayedImports<<anonymous> >::ModuleEntry*)this)->Pe::DelayedImports<<anonymous> >::ModuleEntry::m_descriptor->', which is of non-class type 'const int'
             return m_pe.byRva<typename Types<arch>::ImportNameTableEntry>(m_descriptor->ImportNameTableRVA);
                                                                                         ^~~~~~~~~~~~~~~~~~
Pe/Pe.hpp: In member function 'int Pe::DelayedImports<<anonymous> >::descriptor() const':
Pe/Pe.hpp:1148:31: error: 'DirDelayedImports' was not declared in this scope
         return m_pe.directory<DirDelayedImports>();
                               ^~~~~~~~~~~~~~~~~
Pe/Pe.hpp:1148:50: error: expected primary-expression before ')' token
         return m_pe.directory<DirDelayedImports>();
                                                  ^
Pe/Pe.hpp: In member function 'Pe::DirectoryDescriptor<Pe::Dir<_IMAGE_BOUND_IMPORT_DESCRIPTOR, 11u> > Pe::BoundImports<<anonymous> >::descriptor() const':
Pe/Pe.hpp:1345:46: error: expected primary-expression before '>' token
         return m_pe.directory<DirBoundImports>();
                                              ^
Pe/Pe.hpp:1345:48: error: expected primary-expression before ')' token
         return m_pe.directory<DirBoundImports>();
                                                ^
Pe/Pe.hpp: In member function 'const char* Pe::Exports<<anonymous> >::FunctionEntry::name() const':
Pe/Pe.hpp:1419:40: error: expected primary-expression before 'char'
                 ? m_exports.pe().byRva<char>(*m_name)
                                        ^~~~
Pe/Pe.hpp:1419:40: error: expected ':' before 'char'
Pe/Pe.hpp:1419:40: error: expected primary-expression before 'char'
Pe/Pe.hpp:1419:40: error: expected ';' before 'char'
Pe/Pe.hpp:1419:44: error: expected unqualified-id before '>' token
                 ? m_exports.pe().byRva<char>(*m_name)
                                            ^
Pe/Pe.hpp: In member function 'const void* Pe::Exports<<anonymous> >::FunctionEntry::address() const':
Pe/Pe.hpp:1435:41: error: expected primary-expression before 'void'
             return m_exports.pe().byRva<void>(exportAddressTableEntry()->address);
                                         ^~~~
Pe/Pe.hpp:1435:41: error: expected ';' before 'void'
Pe/Pe.hpp:1435:45: error: expected unqualified-id before '>' token
             return m_exports.pe().byRva<void>(exportAddressTableEntry()->address);
                                             ^
Pe/Pe.hpp: In member function 'const char* Pe::Exports<<anonymous> >::FunctionEntry::forwarder() const':
Pe/Pe.hpp:1445:41: error: expected primary-expression before 'char'
             return m_exports.pe().byRva<char>(exportAddressTableEntry()->forwarderString);
                                         ^~~~
Pe/Pe.hpp:1445:41: error: expected ';' before 'char'
Pe/Pe.hpp:1445:45: error: expected unqualified-id before '>' token
             return m_exports.pe().byRva<char>(exportAddressTableEntry()->forwarderString);
                                             ^
Pe/Pe.hpp: In constructor 'Pe::Exports<<anonymous> >::Exports(const Pe::Pe<arch>&)':
Pe/Pe.hpp:1538:72: error: expected '(' before '>' token
         , m_descriptor(m_directory ? pe.byRva<typename DirExports::Type>(m_directory->VirtualAddress) : nullptr)
                                                                        ^
Pe/Pe.hpp:1541:15: error: expected primary-expression before '{' token
               {
               ^
Pe/Pe.hpp:1541:15: error: expected ':' before '{' token
Pe/Pe.hpp:1541:15: error: expected primary-expression before '{' token
Pe/Pe.hpp: In member function 'const char* Pe::Exports<<anonymous> >::moduleName() const':
Pe/Pe.hpp:1595:27: error: expected primary-expression before 'char'
         return m_pe.byRva<char>(rva);
                           ^~~~
Pe/Pe.hpp:1595:27: error: expected ';' before 'char'
Pe/Pe.hpp:1595:31: error: expected unqualified-id before '>' token
         return m_pe.byRva<char>(rva);
                               ^
Pe/Pe.hpp: In lambda function:
Pe/Pe.hpp:1627:31: error: expected primary-expression before 'char'
             return m_pe.byRva<char>(rva);
                               ^~~~
Pe/Pe.hpp:1627:31: error: expected ';' before 'char'
Pe/Pe.hpp:1627:35: error: expected unqualified-id before '>' token
             return m_pe.byRva<char>(rva);
                                   ^
Pe/Pe.hpp: In member function 'Pe::Exports<<anonymous> >::Export Pe::Exports<<anonymous> >::find(const char*) const':
Pe/Pe.hpp:1662:26: error: expected primary-expression before '(' token
             return Export(m_pe.byRva<void>(exportEntry.address), unbiasedOrdinal + ordinalBase(), ExportType::exact);
                          ^
Pe/Pe.hpp:1662:38: error: expected primary-expression before 'void'
             return Export(m_pe.byRva<void>(exportEntry.address), unbiasedOrdinal + ordinalBase(), ExportType::exact);
                                      ^~~~
Pe/Pe.hpp:1662:38: error: expected ')' before 'void'
Pe/Pe.hpp:1666:26: error: expected primary-expression before '(' token
             return Export(m_pe.byRva<void>(exportEntry.forwarderString), unbiasedOrdinal + ordinalBase(), ExportType::forwarder);
                          ^
Pe/Pe.hpp:1666:38: error: expected primary-expression before 'void'
             return Export(m_pe.byRva<void>(exportEntry.forwarderString), unbiasedOrdinal + ordinalBase(), ExportType::forwarder);
                                      ^~~~
Pe/Pe.hpp:1666:38: error: expected ')' before 'void'
Pe/Pe.hpp: In member function 'Pe::Exports<<anonymous> >::Export Pe::Exports<<anonymous> >::find(unsigned int) const':
Pe/Pe.hpp:1686:26: error: expected primary-expression before '(' token
             return Export(m_pe.byRva<void>(exportEntry.address), unbiasedOrdinal + ordinalBase(), ExportType::exact);
                          ^
Pe/Pe.hpp:1686:38: error: expected primary-expression before 'void'
             return Export(m_pe.byRva<void>(exportEntry.address), unbiasedOrdinal + ordinalBase(), ExportType::exact);
                                      ^~~~
Pe/Pe.hpp:1686:38: error: expected ')' before 'void'
Pe/Pe.hpp:1690:26: error: expected primary-expression before '(' token
             return Export(m_pe.byRva<void>(exportEntry.forwarderString), unbiasedOrdinal + ordinalBase(), ExportType::forwarder);
                          ^
Pe/Pe.hpp:1690:38: error: expected primary-expression before 'void'
             return Export(m_pe.byRva<void>(exportEntry.forwarderString), unbiasedOrdinal + ordinalBase(), ExportType::forwarder);
                                      ^~~~
Pe/Pe.hpp:1690:38: error: expected ')' before 'void'
Pe/Pe.hpp: In member function 'const void* Pe::Relocs<<anonymous> >::PageEntry::page() const':
Pe/Pe.hpp:1774:40: error: expected primary-expression before 'void'
             return m_relocs.pe().byRva<void>(m_entry->VirtualAddress);
                                        ^~~~
Pe/Pe.hpp:1774:40: error: expected ';' before 'void'
Pe/Pe.hpp:1774:44: error: expected unqualified-id before '>' token
             return m_relocs.pe().byRva<void>(m_entry->VirtualAddress);
                                            ^
Pe/Pe.hpp: In constructor 'Pe::Relocs<<anonymous> >::Relocs(const Pe::Pe<arch>&)':
Pe/Pe.hpp:1823:46: error: expected primary-expression before '>' token
         , m_descriptor(pe.directory<DirRelocs>())
                                              ^
Pe/Pe.hpp:1823:48: error: expected primary-expression before ')' token
         , m_descriptor(pe.directory<DirRelocs>())
                                                ^
Pe/Pe.hpp: In constructor 'Pe::Exceptions<<anonymous> >::Exceptions(const Pe::Pe<arch>&)':
Pe/Pe.hpp:1899:50: error: expected primary-expression before '>' token
         : m_descriptor(pe.directory<DirExceptions>())
                                                  ^
Pe/Pe.hpp:1899:52: error: expected primary-expression before ')' token
         : m_descriptor(pe.directory<DirExceptions>())
                                                    ^
Pe/Pe.hpp: In member function 'void (__attribute__((__stdcall__)) * Pe::Tls<<anonymous> >::CallbackEntry::callback() const)(PVOID, DWORD, PVOID)':
Pe/Pe.hpp:1946:92: error: expected primary-expression before 'void'
             return static_cast<typename GenericTypes::FnImageTlsCallback>(m_tls.pe().byRva<void>(rva));
                                                                                            ^~~~
Pe/Pe.hpp:1946:92: error: expected ')' before 'void'
Pe/Pe.hpp:1946:92: error: expected ';' before 'void'
Pe/Pe.hpp:1946:96: error: expected unqualified-id before '>' token
             return static_cast<typename GenericTypes::FnImageTlsCallback>(m_tls.pe().byRva<void>(rva));
                                                                                                ^
Pe/Pe.hpp: In constructor 'Pe::Tls<<anonymous> >::Tls(const Pe::Pe<arch>&)':
Pe/Pe.hpp:1975:47: error: expected primary-expression before '>' token
         , m_directory(pe.directory<DirTls<arch>>())
                                               ^~
Pe/Pe.hpp:1975:50: error: expected primary-expression before ')' token
         , m_directory(pe.directory<DirTls<arch>>())
                                                  ^
Pe/Pe.hpp: In member function 'void (__attribute__((__stdcall__)) * const* Pe::Tls<<anonymous> >::callbacks() const)(PVOID, DWORD, PVOID)':
Pe/Pe.hpp:2005:72: error: expected '(' before '>' token
             return m_pe.byRva<typename GenericTypes::FnImageTlsCallback>(static_cast<Rva>(m_directory.ptr->AddressOfCallBacks - m_pe.imageBase()));
                                                                        ^
Pe/Pe.hpp: In constructor 'Pe::Debug<<anonymous> >::Debug(const Pe::Pe<arch>&)':
Pe/Pe.hpp:2124:45: error: expected primary-expression before '>' token
         , m_descriptor(pe.directory<DirDebug>())
                                             ^
Pe/Pe.hpp:2124:47: error: expected primary-expression before ')' token
         , m_descriptor(pe.directory<DirDebug>())
                                               ^
Pe/Pe.hpp: In member function 'const Pe::CodeView::DebugInfo* Pe::Debug<<anonymous> >::findPdbDebugInfo() const':
Pe/Pe.hpp:2167:72: error: expected primary-expression before '>' token
             const auto* const codeView = m_pe.byRva<CodeView::DebugInfo>(entry.debugEntry()->PointerToRawData);
                                                                        ^

I'm targeting for ANSI support.

@HoShiMin
Copy link
Owner

Which compiler do you use and what means ANSI support?

@winapiadmin
Copy link
Author

The GCC compiler (latest version). I just changing from Unicode strings to normal strings, and some type seem to be not defined.

@HoShiMin
Copy link
Owner

Hm, it seems that the reason not only in strings, but in type definitions. For example, where is the IMAGE_REL_BASED_DIR64? Does your SDK have this macro?

And why do you use GCC for Windows-related stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants