Error de LInker (Error - could not find definition of symbol)

Programe esto en la casa de un amigo, lo compile y simule y funcionó pero cuando lo pruebo en mi pc me larga un error.

Código:
#include <p18f1330.h>
#include <pwm.h>
#include <usart.h>

const unsigned char buff4[]={"RS232 38400bp8n1"};


void main (void) {
   
   OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF &
   USART_ASYNCH_MODE & USART_EIGHT_BIT &
   USART_CONT_RX & USART_BRGH_HIGH,12);      // 19200 bps a 4 MHz

   putrsUSART("Testing Rs232 pic18f1330 \n");


   TRISB = 0X00;

   PTCON0=0b11111100;
   PTCON1=0b10000000;

   PWMCON0=0b01100111;
   PTPERH=0;
   PTPERL=0xff;

   PDC0H=0;
   PDC0L=206;

   PDC1H=0x02;
   PDC1L=0x27;
   

   
   while (1)
   {
      
      Nop();
      Nop();
      Nop();
   }   
}

El error q me larga es el siguiente:

----------------------------------------------------------------------
Debug build of project `C:\pwm1\pwm.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Wed Nov 12 10:51:13 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\pwm1\pwm.o".
Clean: Deleted file "C:\pwm1\pwm.mcs".
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F1330 /i"C:\MCC18\h" "pwm.c" -fo="pwm.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\pwm1\pwm.c:15:Warning [2066] type qualifier mismatch in assignment
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" "18f1330.lkr" "pwm.o" /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"pwm.cof" /M"pwm.map" /W
MPLINK 4.1, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - could not find definition of symbol 'putrsUSART' in file './pwm.o'.
Errors : 1

Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\pwm1\pwm.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Wed Nov 12 10:51:13 2008
----------------------------------------------------------------------
BUILD FAILED


Creo que es un error de librerias, si alguien puede darme una mano por favor, le agradezco de antemano


Les adjunto la carpeta del proyecto
 

Adjuntos

  • pwm1_132.rar
    18.8 KB · Visitas: 12
Encontré esto pero no se mucho inglés, algo de renombrar archivos pero bueno... capaz q alguien lo entiende


EM-7 Linker error: “Could not find definition of symbol...”
This can be caused by using the wrong linker script. Linker scripts for MPLAB C18
include other library files. Make sure to use the linker scripts in the lkr subdirectory of
the MPLAB C18 install.
The project builds OK but when the linker tries to link, the following error is displayed:
Error - could not find definition of symbol 'putsMYFILE' in file
'C:\My Projects\myfile.o'.
Errors : 1
It may be that a C file has the same name as an assembly file, even though they have
different extensions. Look carefully at the Output window to see if it’s trying to generate
two “.o” files with the same name. This is effectively like omitting the first file from the
project. Rename files so that they don’t share the same name.
 
Project -> Build Optiones -> Project, pestaña directories.

Fijate que estén bien los que corresponden a "Include Search Path" (directorio instalación de C18 \h), "Library Search Path" (directorio instalación de C18 \lib), y "Linker Script Search Path" (directorio instalación de C18 \lkr)
 
Ardogan dijo:
Project -> Build Optiones -> Project, pestaña directories.

Fijate que estén bien los que corresponden a "Include Search Path" (directorio instalación de C18 \h), "Library Search Path" (directorio instalación de C18 \lib), y "Linker Script Search Path" (directorio instalación de C18 \lkr)

Gracias por responder!

Ya me había fijado eso y estan bien, tal cual me los pusiste vos...

Se te ocurre que otra cosa puede ser?
 
Puede ser porque esté en modo Debug. Seleccioná en Project->Build Configuration-> Release.
Según la ayuda del mplab ide, en modo Debug hay que usar los archivos .lkr cuyo nombre termina con i (18F8720i.lkr en vez de 18F8720.lkr por ejemplo).
A ver que pasa
 
Ardogan dijo:
Puede ser porque esté en modo Debug. Seleccioná en Project->Build Configuration-> Release.
Según la ayuda del mplab ide, en modo Debug hay que usar los archivos .lkr cuyo nombre termina con i (18F8720i.lkr en vez de 18F8720.lkr por ejemplo).
A ver que pasa


Probé eso pero nada sigue el mismo error...
Ya no sé q hacer, no puedo hacer funcionar la usart! y tengo q presentar el martes un trabajo
 
¿Tenés la misma versión de C18 y MPLAB que en lo de tu amigo?

could not find definition of symbol 'putrsUSART' in file './pwm.o'.

Mmmmm, vos sabés que me bajo el proyecto tuyo, lo compilo y no me da ningún problema... lo ejecuto paso a paso...

Esto es lo que me aparece al compilar:

----------------------------------------------------------------------
Debug build of project `Mis documentos\foro\pwm1\pwm.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Fri Nov 14 09:22:29 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean Warning: File "C:\pwm1\pwm.o" doesn't exist.
Clean: Deleted file "Mis documentos\foro\pwm1\pwm.mcs".
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F1330 /i"C:\MCC18\h" "pwm.c" -fo="pwm.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.21 (demo)
Copyright 2000-2008 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 31
Mis documentos\foro\pwm1\pwm.c:15:Warning [2066] type qualifier mismatch in assignment
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" "18f1330.lkr" "pwm.o" /u_CRUNTIME /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"pwm.cof" /M"pwm.map" /W
MPLINK 4.21, Linker
Copyright (c) 2008 Microchip Technology Inc.
Errors : 0

MP2HEX 4.21, COFF to HEX File Converter
Copyright (c) 2008 Microchip Technology Inc.
Errors : 0

Loaded Mis documentos\foro\pwm1\pwm.cof.
----------------------------------------------------------------------
Debug build of project `Mis documentos\foro\pwm1\pwm.mcp' succeeded.
Preprocessor symbol `__DEBUG' is defined.
Fri Nov 14 09:22:30 2008
----------------------------------------------------------------------
BUILD SUCCEEDED

La única diferencia que encuentro es que el mío dice:
Copyright 2000-2008 Microchip Technology Inc.
y el tuyo
Copyright (c) 2006 Microchip Technology Inc.

además de

Tuyo dijo:
MPLINK 4.1, Linker
Mío dijo:
MPLINK 4.21, Linker

Al ser diferentes versiones de C18 pueden haber cambiado la forma de llamar a algunas funciones.
Bueno, en resumen, fijate en la ayuda de tu C18 si existe la función putrsUSART; por ahí tiene otro nombre para esa versión.
De última probá instalando la última versión de C18.

Ah, por cierto, en la ventana de salida Output->SimUART1 me aparece "esting Rs232 pic18f1330 " sin la T (pero este es el mal más irrisorio al lado del otro).

Saludos
 
Uffff, me alegro, ya era mi última carta .
Exitos/suerte con tu trabajo (no me gusta decir suerte, creo que influye mucho más lo que hacemos que los eventos aleatorios que nos rodean) (a no ser que nos caiga un rayo, o un meteorito... si nos pasa algo de eso indudablemente es mala suerte :LOL: ).

Bueno, un placer haber podido ayudar.
Hasta luego
 
hola estoy teniendo el mismo problema mi codigo es el siguiente:
#include <p18f2525.h>
#include <i2c.h>

#define CLOCK 8 // clock in MHZ
//***************************************************
void main(void)
{
OpenI2C(MASTER, SLEW_ON);// Initialize I2C module
SSPADD = 9; //400kHz Baud clock(9) @16MHz
//100kHz Baud clock(39) @16MHz

while(1)
{
writei2c(0x3e);
writei2c(0x51);
writei2c(0x49);//print 0
writei2c(0x45);
writei2c(0x3e);
}
}

me sale:

Debug build of project `C:\Users\Ernesto\c18 proyects\3\3.mcp' started.
Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01, mcc18.exe v3.30
Preprocessor symbol `__DEBUG' is defined.
Mon Oct 31 16:49:52 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F2525 /i"C:\MCC18\h" "1.c" -fo="1.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\Users\Ernesto\c18 proyects\3\1.c:14:Warning [2058] call of function without prototype
C:\Users\Ernesto\c18 proyects\3\1.c:15:Warning [2058] call of function without prototype
C:\Users\Ernesto\c18 proyects\3\1.c:16:Warning [2058] call of function without prototype
C:\Users\Ernesto\c18 proyects\3\1.c:17:Warning [2058] call of function without prototype
C:\Users\Ernesto\c18 proyects\3\1.c:18:Warning [2058] call of function without prototype
Executing: "C:\MCC18\bin\mplink.exe" /p18F2525 /l"C:\MCC18\lib" /k"C:\MCC18\bin\LKR" "1.o" /u_CRUNTIME /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"C:\Users\Ernesto\c18 proyects\3\3.cof" /M"C:\Users\Ernesto\c18 proyects\3\3.map" /W
MPLINK 4.30.01, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - could not find definition of symbol 'writei2c' in file './1.o'.
Errors : 1

Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Users\Ernesto\c18 proyects\3\3.mcp' failed.
Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01, mcc18.exe v3.30
Preprocessor symbol `__DEBUG' is defined.
Mon Oct 31 16:49:53 2011
----------------------------------------------------------------------
BUILD FAILED
 
Atrás
Arriba