Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Contributions to C::B => Topic started by: ebl on August 25, 2007, 02:54:57 am

Title: how to include .h and .o (beginners question)
Post by: ebl on August 25, 2007, 02:54:57 am
i have draw.h and draw.o i have included draw.h but when i compile it i get this anouncment
.objs\LabCTo21.o:LabCTo21.c:(.text+0x114): undefined reference to `InitializeCards'
when InitializeCards() is a func in draw.o declared in draw.h
so what do i need to do in order to include draw.o
thanks
Title: Re: how to include .h and .o (beginners question)
Post by: Ceniza on August 25, 2007, 03:56:09 am
So you have the .o file but not the original .c/.cpp file...

Try this: Go to Project, Build options..., Linker settings (tab) and add draw.o in Other linker options.
Title: Re: how to include .h and .o (beginners question)
Post by: ebl on August 25, 2007, 10:46:38 am
it's not working
yes i have draw.o and draw.h
Title: Re: how to include .h and .o (beginners question)
Post by: raph on August 25, 2007, 11:28:58 am
Please switch Settings->Compiler and Debugger...->Other settings->Compiler logging to Full command line and post the build log.
Title: Re: how to include .h and .o (beginners question)
Post by: Biplab on August 25, 2007, 11:44:48 am
Do the following.
1) Add draw.o file to project. It will be added to Other section in the project tree.
2) Right click on the draw.o file in the project tree and click on Properties option.
3) Go to Build tab of File properties window and check the Link file option.

This should solve your problem.
Title: Re: how to include .h and .o (beginners question)
Post by: ebl on August 25, 2007, 11:54:46 am
i have truied what you said and still this is what i get:

RandCardDraw.o - the object file

mingw32-g++.exe    -LC:\Programs\programing\CodeBlocks\lib -o C:\workspace\GameCard.exe .objs\RandCardDraw.o .objs\LabCTo21.o       
.objs\LabCTo21.o:LabCTo21.c:(.text+0x114): undefined reference to `InitializeCards'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)