undefined reference to `nitroFSInit'

Post Reply
Lrios4403
Posts: 6
Joined: Fri May 05, 2017 9:38 pm

undefined reference to `nitroFSInit'

Post by Lrios4403 » Fri Dec 20, 2019 4:24 am

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.

User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 94
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

Re: undefined reference to `nitroFSInit'

Post by fincs » 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
Donate to devkitPro - help us stay alive!

Lrios4403
Posts: 6
Joined: Fri May 05, 2017 9:38 pm

Re: undefined reference to `nitroFSInit'

Post by Lrios4403 » Mon Dec 23, 2019 11:52 pm

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!

Lrios4403
Posts: 6
Joined: Fri May 05, 2017 9:38 pm

Re: undefined reference to `nitroFSInit'

Post by Lrios4403 » Mon Dec 23, 2019 11:53 pm

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!

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests