CRT and External Symbols
Posted: Wed Jul 13, 2011 5:20 am
I have created a cutdown C Library, consisting of functions such as printf, putchar, strlen, etc.
I created these in a separate Visual Studio 2010 project to test and compare to the builtin library functions.
NB, I am using C, not C++.
Now I have gotten them working, I have created a new project which will become my OS. I have disabled the builtin CRT (as you know, it won't work with a custom OS). I then imported (cut and paste) my library code into the new project.
Now when I try to compile it, I am getting unresolved external symbol errors:
I did not even know I was calling these functions. I presume they are built into the compiler somehow.
I did find an article suggesting this for one of the symbols:
If I use this the error just changes to:
I have searched around, but I have not yet found anything that helps me.
How does everyone else work around this problem?
Thankyou for your help
I created these in a separate Visual Studio 2010 project to test and compare to the builtin library functions.
NB, I am using C, not C++.
Now I have gotten them working, I have created a new project which will become my OS. I have disabled the builtin CRT (as you know, it won't work with a custom OS). I then imported (cut and paste) my library code into the new project.
Now when I try to compile it, I am getting unresolved external symbol errors:
Code: Select all
C-Lib.lib(printf.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
C-Lib.lib(printf.obj) : error LNK2001: unresolved external symbol __fltused
C-Lib.lib(finite.obj) : error LNK2001: unresolved external symbol __fltused
C-Lib.lib(printf.obj) : error LNK2019: unresolved external symbol __aullshr referenced in function _printf
C-Lib.lib(printf.obj) : error LNK2019: unresolved external symbol __allrem referenced in function _printf
C-Lib.lib(intconv.obj) : error LNK2001: unresolved external symbol __allrem
C-Lib.lib(printf.obj) : error LNK2019: unresolved external symbol __ftol2 referenced in function _printf
C-Lib.lib(printf.obj) : error LNK2019: unresolved external symbol __ftol2_sse referenced in function _printf
C-Lib.lib(intconv.obj) : error LNK2019: unresolved external symbol __alldiv referenced in function _itoa
C-Lib.lib(intconv.obj) : error LNK2019: unresolved external symbol __aulldiv referenced in function _uitoa
C-Lib.lib(intconv.obj) : error LNK2019: unresolved external symbol __aullrem referenced in function _uitoa
I did find an article suggesting this for one of the symbols:
Code: Select all
int _fltused = 1;
Code: Select all
C-Lib.lib(putchar.obj) : error LNK2005: __fltused already defined in main.obj
HAL.lib(console.obj) : error LNK2005: __fltused already defined in main.obj
How does everyone else work around this problem?
Thankyou for your help