Page 1 of 1

undefined reference to `nitroFSInit'

Posted: Fri Dec 20, 2019 4:24 am
by Lrios4403
So I'm trying to work on the rom directory. I can't seem to build the program because of the "filesystem.h" not working properly. For example here is my error:

w:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: main.o: in function `filesysInitalize()':
W:/devkitPro/examples/nds/ChristmasApartments/current/include/filesys.h:16: undefined reference to `nitroFSInit'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitARM/ds_rules:54: /opt/devkitpro/examples/nds/ChristmasApartments/current/current.elf] Error 1


For whatever reason, its not linking nitroFSInit with the libraries. What's even more confusing is the barebones code it's trying to exec and failing:

Code: Select all

#ifndef FILESYS_H
#define FILESYS_H

#include <nds.h>
#include <filesystem.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>

int filesysInitalize()
{
	iprintf("Initializing the filesys... ");
	
	int iResult = nitroFSInit(NULL);
	iprintf("%i \n", iResult);
	
	return 0;
}

#endif
That is it. Am i missing something or am i just stupid? Im trying to learn libnds also so its possible it could be a programmer error.

Re: undefined reference to `nitroFSInit'

Posted: Fri Dec 20, 2019 12:46 pm
by fincs
Make sure the LIBS line in your Makefile looks like this:

Code: Select all

LIBS	:= 	-lfilesystem -lfat -lnds9

Re: undefined reference to `nitroFSInit'

Posted: Mon Dec 23, 2019 11:52 pm
by Lrios4403
fincs wrote: Fri Dec 20, 2019 12:46 pm Make sure the LIBS line in your Makefile looks like this:

Code: Select all

LIBS	:= 	-lfilesystem -lfat -lnds9
Thanks! That worked!

Re: undefined reference to `nitroFSInit'

Posted: Mon Dec 23, 2019 11:53 pm
by Lrios4403
fincs wrote: Fri Dec 20, 2019 12:46 pm Make sure the LIBS line in your Makefile looks like this:

Code: Select all

LIBS	:= 	-lfilesystem -lfat -lnds9
Thanks! I looked at the makefile for the fielder example after you suggested this and I found what I needed to modify!