I installed code blocks first time. I am using windows 10, code blocks version 20.03. When i am trying to compile code i am getting error:
ld.exe cannot find -lsprite
ld.exe cannot find -lbgi
error : ld returned 1 exit status.
I am running hello world code:
When you install Code::Blocks in Windows, it usually takes along some version of the MinGw compiler.
ld.exe is the MinGw linker.
Those error say the linker cannot find the libraries ‘bgi’ and ‘sprite’.
Browsing Internet, it seems bgi could be the “Borland Graphics Interface […] a graphics library bundled with several Borland compilers for the DOS operating systems since 1987” (Wikipedia), while sprite could be part of the SFML library.
It looks like you want to link against those libraries, but you haven’t provided your compiler the proper information (the directories) to find them.
I just want to know that why am i getting those errors and how to resolve them?
You are getting those errors because you’re trying to link against the mentioned libraries the wrong way.
Either you haven’t installed them, or their aren’t in the directories you specified to the compiler, or you missed to specify the directories.
You can resolve those errors by providing the compiler the right information.
I tested my C:B 20.03 install, twice creating a new project. 1st using the Console application template wizard, 2nd time using the Empty project template.
Both compiled C++ "Hello World" code without a problem.
@gsmehta7, something about your installation is borked. I couldn't even begin to try to guess what without a lot more information.
And if/when you can compile code in C:B successfully let us know what you did. That could help others in the future who have the same/similar problems.