c++ - Out Of Memory Error/Can't link
- Bob Paddock (39/39) Aug 10 2006 I'm using DM 8.42 on XP.
- Heinz Saathoff (16/54) Aug 15 2006 ^^^
I'm using DM 8.42 on XP. I have been building a program that has many larger data tables in it. Now I've reached the point where I get a 'Out of memory error' when trying to compile the program after adding a new table. So I've moved the data tables to separate .cpp files, rather than having them all in one single .cpp file. They all compile fine, without the 'Out of memory error' but now I can not get them to link. Something in the compiler is mangling the names by inserting a leading "_", then the linker can not find any names that start with "_". datalogger.cpp contains this: extern "C" { #include "sources/DL100V1_flash.c" /* DataLogger V1 */ }; DL100V1_flash.c contains: const unsigned char DL100V1_Flash[] = { 0x0C, 0x94, 0x77, 0x04, 0x0C, 0x94, 0x81, 0x33, 0x0C, 0x94, 0x90, 0x33, 0x0C, ... }; unsigned long DL100V1_Flash_length = 0x00007EF2; The program where I'm trying to use the information contains: extern "C" { extern const unsigned char DL100V1_Flash[]; extern unsigned long DL100V1_Flash_length; }; struct Devices { const uint8_t *flash_address; uint32_t flash_length; const uint8_t *eeprom_address; uint32_t eeprom_length; } DeviceTable[] = { DL100V1_Flash, DL100V1_Flash_length, 0, 0; }; which leads to this error: Error 42: Symbol Undefined _DL100V2_Flash DebugMSW\BootLoader.obj(BootLoader) [Note the added leading "_".] What am I doing wrong?
Aug 10 2006
Bob Paddock schrieb...datalogger.cpp contains this: extern "C" { #include "sources/DL100V1_flash.c" /* DataLogger V1 */ }; DL100V1_flash.c contains: const unsigned char DL100V1_Flash[] = { 0x0C, 0x94, 0x77, 0x04, 0x0C, 0x94, 0x81, 0x33, 0x0C, 0x94, 0x90, 0x33, 0x0C, ... }; unsigned long DL100V1_Flash_length = 0x00007EF2; The program where I'm trying to use the information contains: extern "C" { extern const unsigned char DL100V1_Flash[]; extern unsigned long DL100V1_Flash_length; }; struct Devices { const uint8_t *flash_address; uint32_t flash_length; const uint8_t *eeprom_address; uint32_t eeprom_length; } DeviceTable[] = { DL100V1_Flash, DL100V1_Flash_length, 0, 0;^^^ semicolon removed}; which leads to this error: Error 42: Symbol Undefined _DL100V2_Flash DebugMSW\BootLoader.obj(BootLoader) [Note the added leading "_".]I compiled your small example without problem. I don't think it's a promblem with the underscore but with missing extern "C" around the definition but included in the declaration, as in ------ file1.cpp ----- unsigned char DL100V2_Flash[] = {/*...*/}; ------ main.cpp ------ extern "C" { unsigned char DL100V2_Flash[]; } ------- end ---------- This will result in such a linker message. The other error could be a misstyped identifier in one file. - Heinz
Aug 15 2006