A Microcontroller Discussion Board
September 09, 2010, 04:42:26 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: You may have to register before you can post: click the register link below to proceed.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: My own library  (Read 1055 times)
0 Members and 1 Guest are viewing this topic.
Darth Maul
Newbie
*
Posts: 2


View Profile Email
« on: January 04, 2008, 09:52:54 PM »

Hi I want to know how to include my own library into my project using SDCC. I tried to put the *.h header file in the same folder as the *.c main program file. The *.h header file only contains functions declarations. Where must I put the *.c file containing functions definitions? I see you put all the functions declarations and definitions in the *.h header file, unlike standard C. Can you explain it please.
Logged
A Microcontroller Discussion Board
« on: January 04, 2008, 09:52:54 PM »

 Logged
Doug
Administrator
Jr. Member
*****
Posts: 92



View Profile WWW
« Reply #1 on: January 05, 2008, 08:16:30 AM »

Indeed, .h should contains only function prototype and it should be implemented in .c file. But, we can also implement function is .h file. C compiler only import the contains in .h file. It allow us to write the the function detail. To include your own library, you should use this

#include "/path/to/myfile.h"

whereas

#include </path/to/myfile.h>

is use for compiler standard directory.
Logged

Microcontroller Programming Blog
http://www.mcuprogramming.com/blog
Darth Maul
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: January 07, 2008, 04:13:40 PM »

It works now. Many thanx Doug!
Logged
A Microcontroller Discussion Board
   

 Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!