Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
#include <p18cxxx.h>void delay (void){ unsigned int i; for (i = 0; i < 10000 ; i++);}void main (void){ TRISB = 0; while (1) { PORTB = 0; delay (); PORTB = 0x5A; delay (); }}
void main (void){printf ("Hello, world!\n");while (1);}
hi nanob0t,there are two ways to print String or char[] in C.try this:#include <stdio.h>void main(){ char t[]="Hello World!"; printf(%s\n",t);}
It sounds like you're missing a device directive. If you look in the 'include' directory of the compiler, do you see a file called 'p18cxxx.h'?You may have to convert the 'xxx' to the actual number of the chip you are using.
Hello. I've been in the microchip forums lately, because of a problem. They don't know, soooo, maybe someone here can help me. I do this on my friends computer, and it works. I hop on my computer and do the exact same thing, exact, and I get errors. Nothing has been configured differently.... install MPLAB, install C18, make program, build all, (insert error if at my terminal): I'll startI have a code. I wanted to input the most basic stuff, so I can just run a test... It doesn't like me... Here's the code:Code: [Select]#include <p18cxxx.h>void delay (void){ unsigned int i; for (i = 0; i < 10000 ; i++);}void main (void){ TRISB = 0; while (1) { PORTB = 0; delay (); PORTB = 0x5A; delay (); }}Simple... I COPIED AND PASTED it from a beginners guide. The program is supposed to run flawlessly. I get a first error saying: TRISB is an undefined character by the library... or something. I got it once, before it got worse. Then PORTB... Whatever. Then the most annoying problem in the world.........MPLINK 4.1, LinkerCopyright (c) 2006 Microchip Technology Inc.Error - could not find definition of symbol 'FSR2L' in file 'C:\Alex's Folder\Programming\ThisProgramDoesn'tLikeToWork\main.o'.Errors : 1Tell me WHERE in that code you see FSR2L???!?!?!?!?!? It's some sample variable that by what I read in 100's of data sheets means absolutely nothing, and is completely irrelevant unless used. And here, I guess the programmer is implying I'm using it?I don't know. Sorry for the lack of professionalism. I am just fed up with it. I've have worked through so many problems with getting this program to just WORK. Encryption errors. Uninstall... Reinstall. Then I get some weird jumbled characters that doesn't let me run it. Uninstall... Reinstall.... I don't know.Tell me someone knows what this is. I would pay you
Error - could not find definition of symbol 'printf' in file 'C:\Alex's Folder\Programming\Phospholipid\main.o'.
Quote from: nanob0t on May 11, 2007, 09:00:21 PMError - could not find definition of symbol 'printf' in file 'C:\Alex's Folder\Programming\Phospholipid\main.o'.sometimes having a 'space' in the file name / directory could cause some problems too.