QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

linking errors in cygwin

This is a discussion on linking errors in cygwin within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; hi. im getting an annoying error in cygwin. i have 2 main files: main.cpp and main.h. here is my main.h: ...

Reply
 
LinkBack Thread Tools
Old 09-27-2006, 03:10 PM   #1

Your Fate is Grim...
 
Grimfate126's Avatar
 
Join Date: Oct 2005
Posts: 2,269
Trader Feedback: 0
Default linking errors in cygwin

hi. im getting an annoying error in cygwin. i have 2 main files: main.cpp and main.h. here is my main.h:
Code:
// Includes
#include <malloc.h>		//For memalign()
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <png.h>
#include <psppower.h>
#include <psptypes.h>
 
//**************************************************************************

// Exit callback
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}
// Callback thread 
int CallbackThread(SceSize args, void *argp) {
          int cbid;
 
          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);
 
          sceKernelSleepThreadCB();
 
          return 0;
}
// Sets up the callback thread and returns its thread id
int SetupCallbacks(void) {
          int thid = 0;
 
          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }
 
          return thid;
}

#include <pspgu.h>
#include <pspgum.h>
#include <psprtc.h>	

#include "graphics.h"
#include "ModelMD2.h"

#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)

#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
#define PI 3.14159265

typedef struct {
	unsigned int color;
	float x, y, z;
} Vertex;

void InitGU( void );			        // Initialize the Graphics Subsystem
void SetupProjection( void );	                // Setups the Projection Matrix
void DrawScene( void );			        // Render Geometry
and my main.cpp is my main code. BUT, when i try to use any of the functions in the file "ModelMD2.h", or if i use any functions from "graphics.h" cygwin gives me linking errors:
Code:
main.cpp:(.text+0x378): undefined reference to `MD2RenderModel(_MODELMD2*)'
main.o: In function `main':
main.cpp:(.text+0x8a0): undefined reference to `MD2AllocateModel(int)'
main.cpp:(.text+0x8bc): undefined reference to `MD2LoadModel(_MODELMD2*, char*,
int)'
main.cpp:(.text+0x8d8): undefined reference to `MD2LoadModel(_MODELMD2*, char*,
int)'
main.cpp:(.text+0x8e8): undefined reference to `MD2ChangeAnimation(_MODELMD2*, i
nt, int)'
collect2: ld returned 1 exit status
make: *** [aso.elf] Error 1
i have declared the functions, so i dont know why cygwin is giving me this error. i asked nexis, and he couldnt "solve" it either. (we spent like 1 hour trying to get this to work. ) so, whats wrong with my code??


P.S. its not cygwin, cause 1 other person tried it and got the same results.
__________________
--------------------------------------------------------------------------------------

Last edited by Grimfate126; 09-27-2006 at 03:21 PM..
Grimfate126 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-27-2006, 03:17 PM   #2

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

Code:
extern "C" {
#include "graphics.h"
#include "ModelMD2.h"
}
__________________

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197

Quote:
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-27-2006, 03:23 PM   #3

Your Fate is Grim...
 
Grimfate126's Avatar
 
Join Date: Oct 2005
Posts: 2,269
Trader Feedback: 0
Default

Quote:
Originally Posted by Insomniac197
Code:
extern "C" {
#include "graphics.h"
#include "ModelMD2.h"
}

does that do in main.h? cause it still wont work. my main.h:

Code:
// Includes
#include <malloc.h>		//For memalign()
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <png.h>
#include <psppower.h>
#include <psptypes.h>
 
#include <pspgu.h>
#include <pspgum.h>
#include <pspctrl.h>

extern "C" {
#include "graphics.h"
#include "ModelMD2.h"
}

//**************************************************************************

// Exit callback
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}
// Callback thread 
int CallbackThread(SceSize args, void *argp) {
          int cbid;
 
          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);
 
          sceKernelSleepThreadCB();
 
          return 0;
}
// Sets up the callback thread and returns its thread id
int SetupCallbacks(void) {
          int thid = 0;
 
          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }
 
          return thid;
}


#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)

#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
#define PI 3.14159265

typedef struct {
	unsigned int color;
	float x, y, z;
} Vertex;

void InitGU( void );			        // Initialize the Graphics Subsystem
void SetupProjection( void );	                // Setups the Projection Matrix
void DrawScene( void );			        // Render Geometry
__________________
--------------------------------------------------------------------------------------
Grimfate126 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-27-2006, 05:06 PM   #4

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

You do have graphics.o, framebuffer.o and ModelMD2.o in the OBJS line of your makefile as well?

I assumed the name of the ModelMD2.o - you will need to add all the C files associated with the MD2 files to your OBJS line.
__________________

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197

Quote:
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-27-2006, 05:36 PM   #5

Your Fate is Grim...
 
Grimfate126's Avatar
 
Join Date: Oct 2005
Posts: 2,269
Trader Feedback: 0
Default

nvm, i fixed it. no idea how, just copied anotehr file over, and now it works. weird.
__________________
--------------------------------------------------------------------------------------
Grimfate126 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
cygwin , errors , linking

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 03:32 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us