Undefined Error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chinnambhrt
Posts: 7
Joined: Sun Nov 02, 2014 12:58 am

Undefined Error

Post 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
Attachments
Herez the error
Herez the error
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: Undefined Error

Post 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?
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Undefined Error

Post 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.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
chinnambhrt
Posts: 7
Joined: Sun Nov 02, 2014 12:58 am

Re: Undefined Error

Post 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
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: Undefined Error

Post by FallenAvatar »

What does your build.sh contain?

- Monk
chinnambhrt
Posts: 7
Joined: Sun Nov 02, 2014 12:58 am

Re: Undefined Error

Post by chinnambhrt »

that automates the source compiling and linking
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: Undefined Error

Post 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
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: Undefined Error

Post 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.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Undefined Error

Post 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.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Undefined Error

Post 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.
Octocontrabass
Member
Member
Posts: 5590
Joined: Mon Mar 25, 2013 7:01 pm

Re: Undefined Error

Post 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.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Undefined Error

Post 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.
Post Reply