Delete Function error

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

37 Replies - 6853 Views - Last Post: 06 February 2013 - 06:27 AM Rate Topic: -----

#16 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3622
  • View blog
  • Posts: 11,290
  • Joined: 05-May 12

Re: Delete Function error

Posted 12 January 2013 - 11:19 AM

A makefile is a file that contains the set of commands to compile the source files in your project, and link them all together to make an executable that you can run.

How do you build your project?

This post has been edited by Skydiver: 12 January 2013 - 11:21 AM

Was This Post Helpful? 0
  • +
  • -

#17 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 810
  • View blog
  • Posts: 2,407
  • Joined: 20-March 10

Re: Delete Function error

Posted 12 January 2013 - 02:42 PM

View Postasasas3354, on 10 January 2013 - 12:42 AM, said:

I have been making a shooter game for fun, and it is not working. I have made few libraries that is of my own. However, it is giving me problemes with the delete function, and if I take them out, I start to have bunch of linker errors that confirms me that delete function is needed...



You havent made a library of your own what you have made are what are called 'header' files

You say you are a newbie at programming while games using a library like Allegro which is an example
of a library usually are made with a more advanced skill set than you currently have.

A newbie mistake is to write a lot of code first then hit compile...

This will produce a lot of errors...

This is the situation you currently find yourself in.....

A better approach is to write a little code then hit compile...

This will produce less errors especially when using a Library like Allegro which employs
the use of pointer logic.

When I say a little code I mean 4 or 5 lines then hit compile.

I understand you probably have a burning desire to make games but at first start with simple games like
rock paper scissors or noughts and crosses then work your way up to space battles or whatever
you are currently trying to program.

I wish you luck

Snoopy.
Was This Post Helpful? 1
  • +
  • -

#18 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 12 January 2013 - 04:55 PM

it is not in a any set of project. it is just one main file with some made libraries.
Was This Post Helpful? 0
  • +
  • -

#19 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3622
  • View blog
  • Posts: 11,290
  • Joined: 05-May 12

Re: Delete Function error

Posted 12 January 2013 - 06:01 PM

Can you tell us the names of those "made libraries"?
Was This Post Helpful? 0
  • +
  • -

#20 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 12 January 2013 - 06:05 PM

oh, apparently, they are header files...

to snoopy 11,

Yes, i know, but i would like to finish the current game that i was making...
Was This Post Helpful? 0
  • +
  • -

#21 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 15 January 2013 - 04:50 PM

so i guess no one could fix this ???
Was This Post Helpful? 0
  • +
  • -

#22 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1371
  • View blog
  • Posts: 4,744
  • Joined: 19-February 09

Re: Delete Function error

Posted 15 January 2013 - 07:24 PM

What compiler are you using?

Are you using an IDE with the compiler?

A project describes what files a compiler uses to create a program. Often it is a list of implementation files (.cpp). Do you know how to create/compile a project with your compiler/IDE.

Have you created implementation files - such as Ship.cpp?
Was This Post Helpful? 0
  • +
  • -

#23 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 15 January 2013 - 07:51 PM

yes, i also have created implementaiton files: ship.cpp, laser.cpp, and character.cpp.

I am using an IDE.

mingw32 is the compiler
Was This Post Helpful? 0
  • +
  • -

#24 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3622
  • View blog
  • Posts: 11,290
  • Joined: 05-May 12

Re: Delete Function error

Posted 16 January 2013 - 05:54 AM

Does your IDE show you the command line it passes to your compiler and linker when it builds your project? Can you show us what it passes in?
Was This Post Helpful? 0
  • +
  • -

#25 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 810
  • View blog
  • Posts: 2,407
  • Joined: 20-March 10

Re: Delete Function error

Posted 16 January 2013 - 07:07 AM

As it currently stands,

you have 43 undefined references to your

1 ship class
2 laser class
3 character class

the headers

Ship.h
Laser.h
Character.h

should be in the same folder as your main.cpp

Is this the current situation ?

You might as well post one of your class implementations
probably posting Ship.h would be most helpful.

Snoopy.
Was This Post Helpful? 0
  • +
  • -

#26 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 17 January 2013 - 06:38 PM

ship.h

#ifndef SHIP_H
#define SHIP_H
#include "Character.h"

class Ship: public Character{

public:
       Ship();
       
       int GetLives();
       void SetLives( int newValue);
       

private:
        int lives;

};

#endif


Was This Post Helpful? 0
  • +
  • -

#27 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 17 January 2013 - 06:45 PM

i do have haderfiles in one folder. i have linked all of them into single project.

now there is a new problem...

i cannot upload the files, the system is giving me a trouble, but all the linker error has been removed.

however, the new problem


multiple definition of `WinMain@16'
[Linker error] undefined reference to `__dyn_tls_init_callback'
[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status
C:\Users\think\Desktop\hw\Makefile.win [Build Error] [Project1.exe] Error 1

if you want me to post any codes, just tell me, ill do that!
Was This Post Helpful? 0
  • +
  • -

#28 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 810
  • View blog
  • Posts: 2,407
  • Joined: 20-March 10

Re: Delete Function error

Posted 17 January 2013 - 07:14 PM

This is a problem with your Dev C++
installation try cleaning the project and rebuilding

Snoopy.
Was This Post Helpful? 0
  • +
  • -

#29 asasas3354  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-January 13

Re: Delete Function error

Posted 05 February 2013 - 04:17 PM

ok. I now only have one problem. Whew.
#ifndef SHIP_H
#define SHIP_H


class Ship: public Character
{

public:
       Ship();
       
       int GetLives();
       void SetLives( int newValue);
       

private:
        int lives;

};

#endif



This is the Ship.h file. The error is

6 C:\Users\think\Desktop\EthernetDrivers\hw\Ship.h expected class-name before '{' token


and I went to variety of websites, and did what it told me, and still am not able to figure it out.I have no more errors other than this.
Was This Post Helpful? 0
  • +
  • -

#30 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3622
  • View blog
  • Posts: 11,290
  • Joined: 05-May 12

Re: Delete Function error

Posted 05 February 2013 - 04:33 PM

Well, it because you have Ship deriving from Character, but you've done nothing to declare Character. You probably should include Character.h.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3