Hello everybody,
I am not able to compile a simple project with only a main function with a call to the function:
getcwd();
Doing a CTRL+Click on the function call (and adding the typical include line on the top of the code) brings me to the expected header, but when compiled, an error appear (I think is a linker problem).
This is the code:
#include "predef.h"
#include <ucos.h>
#include <ip.h>
#include <stdio.h>
//#include <sys/unistd.h>
#include <unistd.h>
#include <buffers.h>
extern "C" {
void UserMain(void * pd);
}
void UserMain(void * pd) {
InitializeStack();
OSChangePrio(MAIN_PRIO);
iprintf("Application started\n");
char buf[2];
int s = 1;
getcwd ( buf, s); //There is the error
}
The compiler directories are OK (project settings), but I am not sure of have added the correct linker libraries. By now, I've added the libraries:
MOD5441X.a
NetBurner.a
FatFile.a
debugLibrary.a
Lua_Full
Which could be the librarie that link to <unistd.h>? (or to <sys/unistd.h>)
The error in NBEclipse is: "undefined reference to `getcwd'". Any help or comment will be very appreciated.
Regards,
Enric
Linker problems calling function getcwd() on unistd.h header
Re: Linker problems calling function getcwd() on unistd.h he
Umm... I'm not sure getcwd makes sense to even use in an embedded environment. Can you articulate what you are attempting to do?
Also, when I say that I'm not sure it even makes sense, that's because you're effectively running the program you're writing as the OS, not something launched from a shell.
-Dan
Also, when I say that I'm not sure it even makes sense, that's because you're effectively running the program you're writing as the OS, not something launched from a shell.
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Linker problems calling function getcwd() on unistd.h he
If you're using the EFFS FAT file system, I believe there is an f_getcwd. Otherwise I'm not sure what you expect getcwd to return.
Re: Linker problems calling function getcwd() on unistd.h he
Thanks to dciliske and sulliwk06. Now, I don't use anymore the getcwd() function.