Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

kiba

Alter Hase

  • »kiba« ist der Autor dieses Themas

Beiträge: 327

Wohnort: NRW

Beruf: Azubi: Fach-Info. Anw.

  • Private Nachricht senden

11

10.12.2008, 17:13

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
class InputGuard{
         public:
            inline ~InputGuard(){
               if(! Input::_instance){
                  delete Input::_instance;
                  Input::_instance = NULL;
               }
             }
      };
      friend class InputGuard;

ist doch public oder was meist du

David_pb

Community-Fossil

Beiträge: 3 886

Beruf: 3D Graphics Programmer

  • Private Nachricht senden

12

10.12.2008, 18:39

Re: wieder linker problem

Zitat von »"kiba"«


C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
//defnif blabla

//define blabla


//include gl,glfw,il

#if defined(CORE_EXPORTS)
    #define DLL __declspec(dllexport)
#else
    #define DLL __declspec(dllimport)
#endif
//....


Graphics.h

C-/C++-Quelltext

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
//defnif blabla

//define blabla


#include "basic.h"

class DLL Graphics{
  private:
  //....

static Graphic* _instance;
class GraphicGuard{
        private:
            inline ~GraphicGuard(){
                if(! Graphic::_instance){
                    delete Graphic::_instance;
                    Graphic::_instance = NULL;
                }
             }
    };
    friend class GraphicGuard;
  public:
  //....

inline static Graphic* getInstanz(){
            static GraphicGuard g;
            if (!Graphic::_instance)
                Graphic::_instance = new Graphic;
            return Graphic::_instance;
        }
};


Input.h

C-/C++-Quelltext

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
//defnif blabla

//define blabla


#include "basic.h"

class DLL Input{
  private:
  //....

static Input* _instance;
class InputGuard{
        private:
            inline ~InputGuard(){
                if(! Input::_instance){
                    delete Input::_instance;
                    Input::_instance = NULL;
                }
             }
    };
    friend class InputGuard;
  public:
  //....

inline static Input* getInstanz(){
            static InputGuard g;
            if (!Input::_instance)
                Input::_instance = new Input;
            return Input::_instance;
        }
};



Nö, is nich public...
@D13_Dreinig

13

10.12.2008, 18:47

Ist das Absicht, oder übersehe ich da grad was?

C-/C++-Quelltext

1
2
3
4
5
if(! Input::_instance) // Löschen, wenn NULL?

{
   delete Input::_instance;
   Input::_instance = NULL;
}

kiba

Alter Hase

  • »kiba« ist der Autor dieses Themas

Beiträge: 327

Wohnort: NRW

Beruf: Azubi: Fach-Info. Anw.

  • Private Nachricht senden

14

10.12.2008, 20:17

upps dumme antwort...
so besser

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
class InputGuard{
         public:
            inline ~InputGuard(){
               if(Input::_instance){
                  delete Input::_instance;
                  Input::_instance = NULL;
               }
             }
      };
      friend class InputGuard;

immernoch feher

Quellcode

1
2
3
4
obj\Debug\main.o||In function `_ZN3F2C5Input10getInstanzEv':|
\..\Graphics\Graphics.h:(.text$_ZN3F2C5Input10getInstanzEv[Input::getInstanz()]+0x80)||undefined reference to `__imp___ZN3F2C5InputC1Ev'|
\..\Graphics\Graphics.h:(.text$_ZN3F2C5Input10InputGuardD1EvInput::InputGuard::~InputGuard()]+0x27)||undefined reference to `__imp___ZN3F2C5InputD1Ev'|
||=== Build finished: 2 errors, 0 warnings ===|


könnte ich den irget was in der main falsch gemacht haben

David_pb

Community-Fossil

Beiträge: 3 886

Beruf: 3D Graphics Programmer

  • Private Nachricht senden

15

10.12.2008, 20:44

Vermutlich hast du vergessen deine dll zu linken...
@D13_Dreinig

kiba

Alter Hase

  • »kiba« ist der Autor dieses Themas

Beiträge: 327

Wohnort: NRW

Beruf: Azubi: Fach-Info. Anw.

  • Private Nachricht senden

16

10.12.2008, 20:47

Re: wieder linker problem

Zitat von »"kiba"«

hi, Hab wieder mal ein Problem
und ich weiß das das ein "Anfänger" Problem ist.
Und ja ich hab alles eingebunden was ich brauche.
(zu mindest sieht es so aus)
Ach ja ich benutz Code::Blocks

...........

Linker:
-libCore.a <-- hier
-devil
-ilu
-ilut
-glfw
-opengl32
-glu32
-gdi32


hab sogar mindessten 5 mal neu gelinkt

build log:

Quellcode

1
2
3
4
5
6
7
mingw32-g++.exe  -o bin\Debug\main.exe obj\Debug\main.o obj\Debug   bin\Debug\libCore.a -lopengl32 -lglu32 -lgdi32 -lglfw -ldevil -lilu -lilut  -mwindows
obj\Debug\main.o: In function `_ZN3F2C5Input10getInstanzEv':
main/../Graphics/Graphics.h:(.text$_ZN3F2C5Input10getInstanzEv[Input::getInstanz()]+0x80): undefined reference to `__imp___ZN3F2C5InputC1Ev'
main/../Graphics/Graphics.h:(.text$_ZN3F2C5Input10InputGuardD1Ev[Input::InputGuard::~InputGuard()]+0x27): undefined reference to `__imp___ZN3F2C5InputD1Ev'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings

Werbeanzeige