Author Topic: how to include .h and .o (beginners question)  (Read 10627 times)

ebl

  • Guest
how to include .h and .o (beginners question)
« 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

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: how to include .h and .o (beginners question)
« Reply #1 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.

ebl

  • Guest
Re: how to include .h and .o (beginners question)
« Reply #2 on: August 25, 2007, 10:46:38 am »
it's not working
yes i have draw.o and draw.h

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: how to include .h and .o (beginners question)
« Reply #3 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.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: how to include .h and .o (beginners question)
« Reply #4 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.
Be a part of the solution, not a part of the problem.

ebl

  • Guest
Re: how to include .h and .o (beginners question)
« Reply #5 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)