ok, i have a slight problem...well 2, the first, and probably the simpler is this, when i compile and link my kernel, i get these errors:
undefined reference to __alloca
undefined reference to ___main
even though i never call them, however if i change int main, to void main, i dont get these.
the second problem is i cant get my class CVideo to work, i have tested the functionallity of the method, outside a class, and it worked fine, but with it encapsulated, the OS, gets to the point where it should be called, and gets to the end (i set a screen char to show the end), but the actual method, does nothing...
i cant figure this out,
my ASM code is assembled using NASM
and my C++ code is compiled using whatever compiler comes with dev-cpp, using the LD linker
any help would be great
Kernel in C++, classes
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Save yourself a lot of trouble... use a Cross-Compiler. ![Cool 8)](./images/smilies/icon_cool.gif)
![Cool 8)](./images/smilies/icon_cool.gif)
i am now utterly confused...does that mean that i have to make a compiler myself?
or can i just edit an existing one so that it does not give me the errors, also does that only relate to the first problem, or would that solve the issue with classes also, i have checked out the bonafide OS dev "doing a kernel in c++" tutorial, but i still cant make a class work
or can i just edit an existing one so that it does not give me the errors, also does that only relate to the first problem, or would that solve the issue with classes also, i have checked out the bonafide OS dev "doing a kernel in c++" tutorial, but i still cant make a class work
You tell your computer to make a compiler suited for your OS. That means, it doesn't pretend that you're using Windows and it stops inserting calls to __alloca etc.znewsham wrote:i am now utterly confused...does that mean that i have to make a compiler myself?
or can i just edit an existing one so that it does not give me the errors, also does that only relate to the first problem, or would that solve the issue with classes also, i have checked out the bonafide OS dev "doing a kernel in c++" tutorial, but i still cant make a class work
For the second, it's probably a linking problem. I can't tell about the actual specific error since you don't provide enough information. What should the function do, what are you testing? Do you construct a proper object? Are you relying on a global object and are you calling the constructors in .ctors and .dtors?
when you say "you tell the compiler" does that mean that you use a command line option, or do i actually have to edit the code?
The object is a local object inside my main function
i don't do CVideo vid =new CVideo();
i simply do CVideo vid
it is not static
the method simply outputs text to the screen, and when i made it printf(), and put it in the same file with main(), it worked fine.
The object is a local object inside my main function
i don't do CVideo vid =new CVideo();
i simply do CVideo vid
it is not static
the method simply outputs text to the screen, and when i made it printf(), and put it in the same file with main(), it worked fine.
It means that you have to compile the source code of the compiler (with different configure flags). It does not imply changing the sourcecode. See the links to the wiki.znewsham wrote:when you say "you tell the compiler" does that mean that you use a command line option, or do i actually have to edit the code?
Is your stack large enough for the object, could you be overwriting system information or going outside of valid memory?znewsham wrote:when you say "you tell the compiler" does that mean that you use a command line option, or do i actually have to edit the code?
The object is a local object inside my main function
i don't do CVideo vid =new CVideo();
i simply do CVideo vid
it is not static
the method simply outputs text to the screen, and when i made it printf(), and put it in the same file with main(), it worked fine.