@abalaban
Here is the makefile for the demo that use libAmiDARK.a :
# GLUT-fullscreen template
#
# See GLUT-fullscreen.c and GLUT-fullscreen2.c for details
#
# written by Hans de Ruiter
#
# License:
# This is provided as-is and can be used and distributed by anyone
# without restrictions.
CC = gcc
CP = copy
RM = delete
STRIP = strip
OPTIMIZE = -O3
DEBUG =
CFLAGS = -mcrt=newlib $(OPTIMIZE) -Wall -gstabs -DMINIGL
TARGET = libAmiDARK.a
# The source files
SRCS = AmiDARK_Compilation.c
# Flags passed to gcc during linking
LINK =
# Additional linker libraries
LIBS = -lGL -lGLUT -lglpng -lpng -lz
# -------------------------------------------------------------
# Nothing should need changing below this line
OBJS = $(SRCS:.c=.o)
# Rules for building
all: $(TARGET)
$(TARGET): $(OBJS)
$(AR) cru $@ $^
RANLIB $@
.PHONY: clean
clean:
$(RM) $(TARGET) $(TARGET).debug $(OBJS)
I get this at compilation of the demo:
gcc -mcrt=newlib -O3 -Wall -gstabs -DMINIGL -c -o AmiDE_3D[MultiCamera].o AmiDE_3D[MultiCamera].c
gcc -mcrt=newlib -O3 -Wall -gstabs -DMINIGL -o AmiDE_3D_MultiCameras.exe.debug AmiDE_3D[MultiCamera].o -lAmiDARK -lGL -lGLUT -lglpng -lpng -lz
/SDK/newlib/lib/crtbegin.o: In function `_start':
(.text+0x14e): undefined reference to `main'
/SDK/newlib/lib/crtbegin.o: In function `_start':
(.text+0x156): undefined reference to `main'
AmiDE_3D[MultiCamera].o: In function `DarkLoop':
AmiDE_3D[MultiCamera].c:37: undefined reference to `DESetDisplayMode'
AmiDE_3D[MultiCamera].c:39: undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:40: undefined reference to `DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:42: undefined reference to `DEPositionObject'
AmiDE_3D[MultiCamera].c:43: undefined reference to `DEColorObjectEx'
AmiDE_3D[MultiCamera].c:44: undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:46: undefined reference to `DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:47: undefined reference to `DEPositionObject'
AmiDE_3D[MultiCamera].c:48: undefined reference to `DEColorObjectEx'
AmiDE_3D[MultiCamera].c:50: undefined reference to `DELoadImage'
AmiDE_3D[MultiCamera].c:51: undefined reference to `DEMakeObjectBox'
AmiDE_3D[MultiCamera].c:52: undefined reference to `DETextureObject'
AmiDE_3D[MultiCamera].c:57: undefined reference to `DESync'
AmiDE_3D[MultiCamera].c:54: undefined reference to `DELoop'
make: *** [AmiDE_3D_MultiCameras.exe] Error 1
Here is the demo source code of the demo that'll use my libAmiDARK.a :
/***********************************************************
**
** AmiDARK Engine Development Project
**------------------------------------
**
** Sample : Basic 3D Objects demonstration
** Author : Frederic Cordier
** Date : 2009JUI24-043821
**
************************************************************
*/
/* OpenGL / MiniGL includes */
#include <gl/glut.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* AmigaOS4 specific includes */
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/timer.h>
#include <proto/keymap.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/timer.h>
#include <interfaces/glut.h>
#include "AmiDARK.h"
float XAngle = 0.0;
void DarkLoop( void ){
DESetDisplayMode( 640, 480, 32 );
DELoadImage( "Images/x4.png", 1 );
DEMakeObjectBox( 1, 5.0, 5.0, 5.0 );
DELoadObject( "cube.deo", 1 );
DEPositionObject( 1, 0.0, 0.0, 10.0 );
DEColorObjectEx( 1, 255, 255, 255 );
DETextureObject( 1, 1 );
DEMakeObjectBox( 2, 5.0, 5.0, 5.0 );
DEPositionObject( 2, 0.0, 5.0, -10.0 );
DEColorObjectEx( 2, 255, 0, 0 );
DELoadImage( "Images/Background.png", 2 );
DEMakeObjectBox( 5, 512, 512, 512 );
DETextureObject( 5, 2 );
while( !DELoop() ){
XAngle = XAngle + 0.25;
DESync();
}
}
Here is the AmiDARK.h file :
#ifndef _AMIDARK_H_
#define _AMIDARK_H_
#include <stdio.h>
extern void DarkENGINE_Start( void );
extern void DarkENGINE_End( void );
extern int DELoop( void );
extern int main( int myargc, char** myargv );
extern void DESetDisplayMode( int Width, int Height, int Depth );
extern void DELoadImage( const char * FileName, int ImageIndex );
extern void DEMakeObjectBox( int ObjectID, int Width, int Height, int Depth );
extern void DELoadObject( char * FileName, int ObjectID );
extern void DEPositionObject( int ObjectID, float XPos, float YPos, float ZPos );
extern void DEColorObjectEx( int ObjectID, int RGBR, int RGBG, int RGBB );
extern void DETextureObject( int ObjectID, int ImageID );
extern void DESync();
Apparently, all seem to be setup correctly.
Where am I wrong ?