Note that there are some explanatory texts on larger screens.

plurals
  1. POError with Struct in C++
    text
    copied!<p>I'm having a problem with a struct when trying to do this in C++ (visual studio):</p> <p>memoria.cpp</p> <pre><code> struct readMem { UINT32 startAdress; UINT32 endAdress; UINT8(*memoryHandler) (UINT32); void *pUserData; }; struct writeMem { UINT32 startAdress; UINT32 endAdress; void (*memoryHandler) (UINT32, UINT8); void *pUserData; }; void memoria::writeRAMBankEnable(UINT32 a, UINT8 b) { } void memoria::writeROMBankSelect(UINT32 a, UINT8 b) { } void memoria::writeRAMROMModeSelect(UINT32 a, UINT8 b) { } void memoria::writeVRAM(UINT32 a, UINT8 b) { } void memoria::writeSRAM(UINT32 a, UINT8 b) { } void memoria::writeRAM(UINT32 a, UINT8 b) { } void memoria::writeERAM(UINT32 a, UINT8 b) { } void memoria::writeSprite(UINT32 a, UINT8 b) { } void memoria::writeIOM(UINT32 a, UINT8 b) { } void memoria::writeHRAM(UINT32 a, UINT8 b) { } struct writeMem implWriteMem[] = { { 0x0000, 0x1FFF, writeRAMBankEnable, NULL}, { 0x4000, 0x5FFF, writeROMBankSelect, NULL}, { 0x6000, 0x7FFF, writeRAMROMModeSelect, NULL}, { 0x8000, 0x9FFF, writeVRAM, NULL}, { 0xA000, 0xBFFF, writeSRAM, NULL}, { 0xC000, 0xDFFF, writeRAM, NULL}, { 0xE000, 0xFDFF, writeERAM, NULL}, { 0xFE00, 0xFE9F, writeSprite, NULL}, { 0xFF00, 0xFF7F, writeIOM, NULL}, { 0xFF80, 0xFFFF, writeHRAM, NULL}, { (UINT32) - 1, (UINT32) - 1, NULL, NULL} }; memoria.h #pragma once #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include "defs.h" ref class memoria { public: memoria(void); private: FILE *file; UINT8 *mem; public: void writeRAMBankEnable(UINT32, UINT8); void writeROMBankSelect(UINT32, UINT8); void writeRAMROMModeSelect(UINT32, UINT8); void writeVRAM(UINT32, UINT8); void writeSRAM(UINT32, UINT8); void writeRAM(UINT32, UINT8); void writeERAM(UINT32, UINT8); void writeSprite(UINT32, UINT8); void writeIOM(UINT32, UINT8); void writeHRAM(UINT32, UINT8); UINT8 readRAMBankEnable(UINT32); UINT8 readROMBankSelect(UINT32); UINT8 readRAMROMModeSelect(UINT32); UINT8 readVRAM(UINT32); UINT8 readSRAM(UINT32); UINT8 readRAM(UINT32); UINT8 readERAM(UINT32); UINT8 readSprite(UINT32); UINT8 readIOM(UINT32); UINT8 readHRAM(UINT32); void Meminitialize(); void MemcleanUp(); void writeByte(UINT32, UINT8); UINT8 readByte(UINT32); void writeWord(UINT32, UINT16); UINT16 readWord(UINT32); }; </code></pre> <p>Visual studio c++ gives me this errors:</p> <p>1>memoria.cpp(75): error C2065: 'writeRAMBankEnable' : undeclared identifier</p> <p>1>memoria.cpp(76): error C2065: 'writeROMBankSelect' : undeclared identifier</p> <p>1>memoria.cpp(77): error C2065: 'writeRAMROMModeSelect' : undeclared identifier</p> <p>1>memoria.cpp(78): error C2065: 'writeVRAM' : undeclared identifier</p> <p>1>memoria.cpp(79): error C2065: 'writeSRAM' : undeclared identifier</p> <p>1>memoria.cpp(80): error C2065: 'writeRAM' : undeclared identifier</p> <p>1>memoria.cpp(81): error C2065: 'writeERAM' : undeclared identifier</p> <p>1>memoria.cpp(82): error C2065: 'writeSprite' : undeclared identifier</p> <p>1>memoria.cpp(83): error C2065: 'writeIOM' : undeclared identifier</p> <p>1>memoria.cpp(84): error C2065: 'writeHRAM' : undeclared identifier</p> <p>1>memoria.cpp(169): error C2065: 'implReadMem' : undeclared identifier</p> <p>1>memoria.cpp(179): error C2065: 'implReadMem' : undeclared identifier</p> <p>For the record, I have declared all the functions in my memoria.h, all but the structs and the implWriteMem[], of course. Anyway, how can I solve that?</p> <p>P.S. It worked quite well in pure C.</p> <p>Thanks !</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload