How can I fix these errors ? win32 API

I get 8 errors, actually is the same one:

||=== Build: Debug in Win32ListView (compiler: GNU GCC Compiler) ===|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
|25|error: initializer-string for array of chars is too long [-fpermissive]|
||=== Build failed: 8 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#if defined(UNICODE) && !defined(_UNICODE)
    #define _UNICODE
#elif defined(_UNICODE) && !defined(UNICODE)
    #define UNICODE
#endif
#define _win32_IE 0x300

#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <string.h>
#include "listview.h"

ABRINFO argsAbrInfo[] =
{
	{"LoD", "Lord of Destruction"},
	{"PvP", "Player versus Player"},
	{"XP", "Experience"},
	{"Javazon", "Javelin build Amazon"},
	{"HOTO", "Hart of the Oak Runeword"},
	{"Assa", "Assassin Character"},
	{"Andy", "Final Boss Act 1 Andariel"},
	{"D2", "Diablo 2 Classic"},
	{"PVM", "Player versus Monsters"}
};
.
.
.
..


my listview.h looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// LISTVIEW.H

// constants
#define ID_LISTVIEW     1000

#define NUM_ITEMS       9
#define NUM_COLUMNS     2
#define MAX_ITEMLEN     64
#define MAX_SYMBOLS     64
#define MAX_DESCRIPTION 16

// stringtable defines
#define IDS_SYMBOLS     1
#define IDS_DESCRIPTION 2

// Function prototypes

// procs
long APIENTRY MainWndProc(HWND, UINT, UINT, LONG);

//functions
BOOL InitApplication(HANDLE);
BOOL InitInstance(HANDLE, int);
HWND CreateListView(HWND);
LRESULT NotifyHandler(HWND, UINT, WPARAM, LPARAM);

// structures
typedef struct tagABRINFO
{
    char szSymbol[MAX_SYMBOLS];
    char szDescription[MAX_DESCRIPTION];
} ABRINFO;
Last edited on
1
2
3
4
5
6
7
8
#define MAX_SYMBOLS     64
#define MAX_DESCRIPTION 16
...
typedef struct tagABRINFO
{
    char szSymbol[MAX_SYMBOLS];  // aka 64, for things like "Lod"
    char szDescription[MAX_DESCRIPTION];  // aka 16, for things not like "Lord of Destruction"
} ABRINFO;

Me thinks your sizes are the wrong way round.
Yup.. thanks again .. that was very very right.. I didn't pay much attention for the size.
now it's working just fine..

:)
Topic archived. No new replies allowed.