Page 1 of 1
Undefined Error
Posted: Mon Nov 10, 2014 11:26 pm
by chinnambhrt
Hi guys I'm on GDT now..
while linking..linker says.. undefined reference to gdtLoad even though it is defined in my GDT.s
I've looked whether i've missed any object files..but I haven't missed none..
Help me
Thanks in advance
Re: Undefined Error
Posted: Tue Nov 11, 2014 12:01 am
by alexfru
Did you declare it as global in the asm code?
Did you declare it as extern "C" in the C++ code?
Did you link all the object files together?
Re: Undefined Error
Posted: Tue Nov 11, 2014 12:20 am
by Roman
You need to compile your assembly and C files in object files, then link them. Also, you need to have an "extern" in your C code.
Re: Undefined Error
Posted: Tue Nov 11, 2014 12:35 am
by chinnambhrt
Yes..I've declared extern in my C code and Global in Assembly code..but still i've this on my head..
look at the transparent terminal
Re: Undefined Error
Posted: Tue Nov 11, 2014 12:37 am
by FallenAvatar
What does your build.sh contain?
- Monk
Re: Undefined Error
Posted: Tue Nov 11, 2014 12:50 am
by chinnambhrt
that automates the source compiling and linking
Re: Undefined Error
Posted: Tue Nov 11, 2014 1:38 am
by FallenAvatar
chinnambhrt wrote:that automates the source compiling and linking
Sorry that I was not more clear. Post the contents of your build.sh here in code tags, or to a site like
pastebin.net so that we can see what commands you are actually executing.
Even better would be a console log with all those commands and their results visible.
- Monk
Re: Undefined Error
Posted: Tue Nov 11, 2014 2:01 am
by alexfru
chinnambhrt wrote:Yes..I've declared extern in my C code and Global in Assembly code..but still i've this on my head..
look at the transparent terminal
From the image that you provided I conclude that you're compiling C++ code. Are you sure that in your C++ code the function is declared as extern "C"? extern "C" is not the same as extern. Also, does your C/C++ compiler expect identifiers to be prefixed or suffixed by an underscore character inside object files/libraries? If it does, you need to adjust your asm code appropriately.
Re: Undefined Error
Posted: Tue Nov 11, 2014 2:01 am
by Nable
IMHO: there's problem with filenames, they are all upper-case. I think that it leads compiler to a wrong idea that code in files is in C++, not C.
Man, it's not DOS, size^W character case matters here.
Re: Undefined Error
Posted: Tue Nov 11, 2014 2:47 am
by iansjack
alexfru wrote:chinnambhrt wrote:Yes..I've declared extern in my C code and Global in Assembly code..but still i've this on my head..
look at the transparent terminal
From the image that you provided I conclude that you're compiling C++ code. Are you sure that in your C++ code the function is declared as extern "C"? extern "C" is not the same as extern. Also, does your C/C++ compiler expect identifiers to be prefixed or suffixed by an underscore character inside object files/libraries? If it does, you need to adjust your asm code appropriately.
Surely the messages show that if it were C++ it wouldn't compile?
Without seeing the source files or the build commands it's anybody's guess what the OP is doing wrong. (And I very much doubt that, as suggested elsewhere, the case of the filename has any bearing on it). Not a lot of point in guessing when a little more information would provide the answer.
Re: Undefined Error
Posted: Tue Nov 11, 2014 3:13 am
by Octocontrabass
iansjack wrote:(And I very much doubt that, as suggested elsewhere, the case of the filename has any bearing on it).
It does.
Re: Undefined Error
Posted: Tue Nov 11, 2014 3:21 am
by iansjack
Octocontrabass wrote:iansjack wrote:(And I very much doubt that, as suggested elsewhere, the case of the filename has any bearing on it).
It does.
Your right. I was completely mistaken. The output shows that the C++ compiler is being used.