I used to program wuite often with C++, but then I stopped and now I have started again, ym problem is with a dll im making:

DLL.H

#ifndef _DLL_H_
#define _DLL_H_
/* Begin User-Defined */
#define export extern "C" __declspec (dllexport)
/* End User Defined   */

#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */


class DLLIMPORT DllClass
{
  public:
    DllClass();
    virtual ~DllClass(void);

  private:

};


#endif /* _DLL_H_ */

DLLMAIN.CPP

#include "dll.h"
#include <windows.h>

int objects[500][4];
int max_objects=0;

export double initPhys1kz(double objects)
{
       
       max_objects=objects;
       
       for(int count=0;count<max_objects;count++){
             
             objects[count][1]=0;
             objects[count][2]=0;
             objects[count][3]=0;
             objects[count][4]=0;
             }
             return double(1);
       }

These errors are returned:

10 [file path] [Warning] converting to `int' from `double' 
14 [file path] invalid types `double[int]' for array subscript 
15 [file path] invalid types `double[int]' for array subscript 
16 [file path] invalid types `double[int]' for array subscript
17 [file path] invalid types `double[int]' for array subscript

If it helps im using DevC++ by bloodshed.

Please tell me what these errors mean.

Recommended Answers

All 4 Replies

> objects[count][1]=0;
1. Arrays subscripts start at 0, not 1. So you should be writing to [0] to [3], not [1] to [4]

2. Check the name of the parameter, and compare it with the name of your global array.
Then understand what scope rules mean :)

Hey Thanks!


1 more problem, a build error:

[Build Error]  No rule to make target `dll.o'.  Stop.

This onyl happens when compiling 'dll.h' not 'dllmain.cpp', what does this mean?


Was it something I did wrong? Or my compilers fault?

EDIT:
and whem I try to compile all files at once, this comes up:

[Build Error]  No rule to make target `Phys1kz_private.rc', needed by `Phys1kz_private.res'.  Stop.

Did you start with the "create DLL project" template?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.