#68163 - leif902 - Sun Jan 22, 2006 10:37 pm
Okay, i've been trying to make some apps using the wifilib... when I try to compile the demo (after converting to C++) however I get this output(shortened):
Code: |
/c/devkitPro/devkitARM/bin/arm-elf-g++ -g -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I/c/devkitPro/libnds/include -DARM7 -c Source/arm7_main.cpp -o arm7_main.o
/c/devkitPro/devkitARM/bin/arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs arm7_main.o -L/c/devkitPro/libnds/wifi_lib/arm7/dswifi7.lib -L/c/devkitPro/libnds/lib -lnds7 -o arm7.elf
arm7_main.o: In function `main':
Source/arm7_main.cpp:108: undefined reference to `Wifi_Init'
Source/arm7_main.cpp:107: undefined reference to `Wifi_Interrupt'
arm7_main.o: In function `VblankHandler()':
Source/arm7_main.cpp:85: undefined reference to `Wifi_Update'
make: *** [arm7.elf] Error 1
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
|
Any Ideas?
Thanks
-Leif902
#68175 - Maverick - Sun Jan 22, 2006 11:37 pm
'Undefined reference to' means that in the headers, there is a function prototype that has no actual function after it
I am having similar problems trying to get 3d to work
_________________
http://downtou.ne1.net/
#68182 - leif902 - Mon Jan 23, 2006 12:34 am
hm... thanx for the reply but I know this... i must not have been clear (sorry)... The functions are all external functions in the lib, the header defines them from the lib... so this should work... the lib is linked properly too...
#68231 - tepples - Mon Jan 23, 2006 3:41 am
leif902 wrote: |
the lib is linked properly too... |
I wouldn't be so sure. Check this first.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#68373 - leif902 - Tue Jan 24, 2006 1:16 am
nope it's linked properly... i tried linking it a couple different places and ways w/ a couple make files... same error (just w/ different calls)
#68377 - cybereality - Tue Jan 24, 2006 3:15 am
Are you using the most updated version of libnds and the wifilib 0.2b? I had no issues compiling the source (using GCC). Also make sure that the wifi lib is in the same main folder as the makefile or in the path somehow. It sounds like your code is having a problem finding it.
_________________
// cybereality
#68416 - wintermute - Tue Jan 24, 2006 1:05 pm
Maverick wrote: |
'Undefined reference to' means that in the headers, there is a function prototype that has no actual function after it |
No it doesn't.
It means that the linker can't find the function, usually because the required library hasn't been linked or the prototypes are not guarded by extern "C" { } when using a C library with C++.
leif902 wrote: |
nope it's linked properly... i tried linking it a couple different places and ways w/ a couple make files... same error (just w/ different calls) |
Doesn't look like it to me.
From your first post.
Code: |
-L/c/devkitPro/libnds/wifi_lib/arm7/dswifi7.lib
|
-L specifies a directory for library searching, not the library.
The .lib files provided should be renamed to libdswifi7.a and libdswifi9.a, the path to these files specified with -L then use -ldswifi7 or -ldswifi9 as appropriate.
#68492 - leif902 - Wed Jan 25, 2006 1:38 am
lol oh right... man do i feel stupid now... i didn't even notice that :D lol thanx -Leif902
#68494 - leif902 - Wed Jan 25, 2006 1:58 am
oh... nevermind... its still giving me the exact same error.... my linker line now reads as follows (just for
arm9)...
Code: |
arm9.elf: arm9_main.o
$(DEVKITARM)/bin/arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs arm9_main.o -L$(NDSLIB_LIB) -lnds9 -L$(DEVKITPRO)/libnds/wifi_lib/arm9/ -dswifi9 -o arm9.elf |
Any ideas?
#68537 - agentq - Wed Jan 25, 2006 1:10 pm
At first glance, it appears that -dswifi9 should be -ldswifi9, if it's intention was to link with libdswifi9.a
#68616 - leif902 - Thu Jan 26, 2006 2:17 am
no i changed the name... thats the right spelling...
#68623 - wintermute - Thu Jan 26, 2006 2:44 am
leif902 wrote: |
no i changed the name... thats the right spelling... |
yeah but you missed the -l which tells the linker to look for a library called libdswifi9
-ldswifi9 *not* -dswifi9
#68626 - leif902 - Thu Jan 26, 2006 2:50 am
omg... i knew it would be something stupid i left out... but i didn't expect to embarase myself twice :D (lol as i've said a thousand times on a thousand forums, i hate makefiels) thanx i'll go fix that :) -Leif902
#68627 - leif902 - Thu Jan 26, 2006 2:58 am
dang... okay one more problem (i'm stupid when come compile time...)
Code: |
arm7_main.o:Source/arm7_main.cpp:90: first defined here
c:\devkitpro\devkitarm\bin\..\lib\gcc\arm-elf\4.0.2\..\..\..\..\arm-elf\bin\ld.exe: Warning: size of symbol `main' changed from 196 in arm7_main.o to 292 in c:/devkitPro\lib/../libnds/wifi_lib/arm7/dswifi7.a(main.o)
|
this i understand, they both of course have main functions... just how do i fix it? -Leif902
#68750 - HyperHacker - Thu Jan 26, 2006 6:09 pm
My guess is your main() has the wrong return type or parameters. It should look like this:
int main(int argc, char** argv)
AFAIK this is a standard format used on all platforms. (Windows seems to use its own, but note that it's not actually main(), it's WinMain().) I'm not sure what, if anything, the parameters and return do on DS, but they should be there.
#68792 - josath - Thu Jan 26, 2006 8:14 pm
Post the entire output, including the line that shows what params are being passed to the linker. Otherwise, how can we know what is done wrong?
At first glance I see 'dswifi7.a' which i think is wrong, it really should be 'libdswifi.a' ... all libraries are supposed to start with 'lib' and end with '.a'.
Possibly you are putting 'dswifi7.a' on the commandline, as opposed to '-ldswifi7'. (a guess, since you didn't show the commandline).
#68818 - wintermute - Thu Jan 26, 2006 11:06 pm
There appears to be a slight problem with the prebuilt library including some test code. Delete the offending object files with
Code: |
arm-elf-ar -d dswifi9.lib main.o ASCII.o asmintr.o
|
replace dswifi9.lib with libdswifi9.a if you renamed.
Or rebuild the library from the source.
#68847 - leif902 - Fri Jan 27, 2006 1:51 am
okay, i'll try rebuilding... all libs are supposed to start w/ lib? woah i didn't know that... hm... thanx, (oh and btw, my main has the right params, i'm not that incompetent :D )
thanx
-Leif902
#68850 - leif902 - Fri Jan 27, 2006 2:01 am
okay thanx, i used those suggestions and it compiles correctly now :) (well it gives me some errors, but just c to C++ stuff i know how to fix :) no make file junk)
-Leif902