What library should I use for not have any compiler error?

Go To Last Post
53 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What library should I use for not have any compiler error?

I test with several and all give compiler errors. 

I attached the last library I used.

 

I copy & paste the codi from here, which is:

 

/*
 * 
 */ 

# define F_CPU 11592000UL

# define BAUDRATE 9600

# define BAUD_PRESCALE ((( F_CPU / ( BAUDRATE * 16UL))) - 1)

#define AS 20 // SIZE OF ARRAY

#define MAX 300         //max size of sentence buffer

#define lcd_clrscr
#define lcd_init
#define lcd_putc
#define lcd_puts

char NMEA[300];

#include <avr/io.h>

#include <string.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <avr/interrupt.h>

#include <lcd.h>

#include <util/delay.h>

char kalpesh;

char buffer[10];

char buffer1[50];

int   z = 0, i1 = 0;

int result;

double fp,fp1,fp2,fp3;

uint16_t int4, int5;

char a[AS], b[AS], c[AS], d[AS], e[AS], f[AS], g[AS], h[AS], i[AS], j[AS], k[AS], l[AS], m[AS];

// function to initialize UART

void uart_init (void)
{
	UCSR0B = (1<<TXEN0)|(1<<RXEN0)|(0<<RXEN0);             //enable receiver and transmitter
	//	UCSR0C = (0<<UMSEL)|(1<<UCSZ0)|(1<<UCSZ1);// 8bit data format // UMSEL 0 FOR ASYNCH /
	UCSR0C = (1<<USBS0)|(3<<UCSZ00);
	UBRR0H = (BAUD_PRESCALE>>8);//set baud rate
	UBRR0L = BAUD_PRESCALE;
}

void uart_transmit (char data)
{

	while (!(UCSR0A) && (1<<UDRE0));         // wait while register is free
	UDR0 = data;                             // load data in the register

}

// function to receive data

char uart_recieve (void)
{
	while((UCSR0A & (1 << RXC0)) == 0);             // wait while data is being received
	return UDR0;                             // return 8-bit data
}

// function to received data ATMEL Example

unsigned char USART_Receive( void )

{

	/* Wait for data to be received */

	while ( !(UCSR0A & (1<<RXC0)) ); 

	/* Get and return received data from buffer */

	return UDR0;

}

void uart_puts(char *str)

{

	while(*str)

	{

		uart_transmit(*str++);

	}

}


int main()

{

	//DDRD = 0XFF;

	DDRC = 0XFF;

	//   sei();

	uart_init();

	lcd_init(LCD_DISP_ON);

	lcd_puts("SYSTEM INIT....");

	_delay_ms(500);

	lcd_clrscr();

	char kalpesh;

	while(1)

	{

		kalpesh = USART_Receive();

		//   lcd_putc(kalpesh);

		for(z=0;z<300;z++)

		{

			NMEA[z] = kalpesh;

		}

		lcd_putc(NMEA[0]);

	}
}





The compiler  errors are:

 

Error expected ')' before 'dispAttr' 

Error expected expression before ')' token 

Error expected identifier or '(' before 'char' 

Error expected identifier or '(' before 'const' 

Error expected identifier or '(' before 'void' 

Warning statement with no effect 

Warning statement with no effect 

 

 

Thank you

 

 

Attachment(s): 

Last Edited: Thu. Dec 7, 2017 - 08:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Navidulce wrote:
The compiler  errors are: [...]

No file names, no line numbers.. That makes it more or less impossible to help you.

 

The one error I can help you with is 

Navidulce wrote:
Error expected ')' before 'dispAttr' 

If you look in the files lcd.c and lcd.h you will find "dispAttr" as a parameter to

void lcd_init(uint8_t dispAttr)

The type of the parameter is uint8_t, which is defined in stdint.h, so somewhere before your

#include <lcd.h>

you need a

#include <stdint.h>

 

For all the other errors we need more info. Do this:

1) Rebuild (i.e. a clean and a build)

2) Switch to the Output tab

3) Mark everything

4) Copy

5) Paste into a post here

 

That info will give us some chance of helping you.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:

#define lcd_clrscr

#define lcd_init

#define lcd_putc

#define lcd_puts

 

These are overriding the declarations in the lcd.h file.

 

Edit: What device are you targeting?

David (aka frog_jr)

Last Edited: Thu. Dec 7, 2017 - 07:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, JohanEkdahl  

I included this line:

#include <stdint.h>

The errors are:

 

error: expected ')' before 'dispAttr'

in line extern void lcd_init(uint8_t dispAttr);

                              ^

error: expected identifier or '(' before 'void'

in line extern void lcd_clrscr(void);

                        ^

error: expected identifier or '(' before 'char'

in line extern void lcd_putc(char c);

                      ^

error: expected identifier or '(' before 'const'

in line extern void lcd_puts(const char *s);

                      ^

warning: statement with no effect [-Wunused-value]

 in line  lcd_init(LCD_DISP_ON);

          ^

warning: statement with no effect [-Wunused-value]

 in line lcd_puts("SYSTEM INIT....");

          ^

error: expected expression before ')' token

 in line lcd_clrscr();

             ^

warning: statement with no effect [-Wunused-value]

in line   lcd_putc(NMEA[0]);

Last Edited: Thu. Dec 7, 2017 - 07:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi frog_jr

 

The device is atmega328p

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All the error are in main.c which is the code I found in this post (not in libraries, document attached)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you delete the four defines I showed in Post #64?

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Navidulce wrote:
The device is atmega328p
The mega328 does not have a PORTA as setup in lcd.h line #139

138  #ifndef LCD_PORT
139  #define LCD_PORT         PORTA        /**< port for the LCD lines   */
140  #endif

 

You will need to set this for your specific port usage...

 

 

 

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
The errors are:

Navidulce wrote:
All the error are in main.c which

Don't tell us how to analyze the problem. If you know how to, then do it yourself. If you want our help then please follow directions.

 

I'll give you one more chance.

 

Read the below instructions. Follow them. To the letter.

1) Rebuild (i.e. a clean and a build)

2) Switch to the Output tab

3) Mark everything

4) Copy

5) Paste into a post here

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Thu. Dec 7, 2017 - 08:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
Last Edited: Thu. Dec 7, 2017 - 02:38 PM
Now you've gone and edited the first post without giving us any indication of what you have changed.

This is not the way to solicit assistance...

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I did it frog_jr

 

/*
 * 
 Title:    LCD with Neo M6 
 File:	    main.c
 IDE:  Atmel Studio 7
 Target:   Atmel 328p
 *
 */ 

# define F_CPU 11592000UL
# define BAUDRATE 9600
# define BAUD_PRESCALE ((( F_CPU / ( BAUDRATE * 16UL))) - 1)
#define AS 20 // SIZE OF ARRAY
#define MAX 300         //max size of sentence buffer
#define LCD_PORT         PORTC
#define LCD_DATA0_PORT   LCD_PORT
#define LCD_DATA1_PORT   LCD_PORT
#define LCD_DATA2_PORT   LCD_PORT
#define LCD_DATA3_PORT   LCD_PORT
#define LCD_DATA0_PIN    2            /** is this LCD D4 pin?  */
#define LCD_DATA1_PIN    3            /** is this LCD D5 pin?  */
#define LCD_DATA2_PIN    4            /** is this LCD D6 pin?  */
#define LCD_DATA3_PIN    5            /** is this LCD D7 pin?  */
#define LCD_RS_PORT      LCD_PORT
#define LCD_RS_PIN       0
#define LCD_RW_PORT      LCD_PORT
#define LCD_RW_PIN       6            /** i did'n connect this pin */
#define LCD_E_PORT       LCD_PORT
#define LCD_E_PIN        1

char NMEA[300];

#include <avr/io.h>

#include <string.h>

#include <stdio.h>

#include <stdint.h>

#include <stdlib.h>

#include <string.h>

#include <avr/interrupt.h>

#include <lcd.h>

#include <util/delay.h>

char kalpesh;

char buffer[10];

char buffer1[50];

int   z = 0, i1 = 0;

int result;

double fp,fp1,fp2,fp3;

uint16_t int4, int5;

char a[AS], b[AS], c[AS], d[AS], e[AS], f[AS], g[AS], h[AS], i[AS], j[AS], k[AS], l[AS], m[AS];

// function to initialize UART

void uart_init (void)
{
	UCSR0B = (1<<TXEN0)|(1<<RXEN0)|(0<<RXEN0);             //enable receiver and transmitter
	//	UCSR0C = (0<<UMSEL)|(1<<UCSZ0)|(1<<UCSZ1);// 8bit data format // UMSEL 0 FOR ASYNCH /
	UCSR0C = (1<<USBS0)|(3<<UCSZ00);
	UBRR0H = (BAUD_PRESCALE>>8);//set baud rate
	UBRR0L = BAUD_PRESCALE;
}

void uart_transmit (char data)
{

	while (!(UCSR0A) && (1<<UDRE0));         // wait while register is free
	UDR0 = data;                             // load data in the register

}

// function to receive data

char uart_recieve (void)
{
	while((UCSR0A & (1 << RXC0)) == 0);             // wait while data is being received
	return UDR0;                             // return 8-bit data
}

// function to received data ATMEL Example

unsigned char USART_Receive( void )

{

	/* Wait for data to be received */

	while ( !(UCSR0A & (1<<RXC0)) ); 

	/* Get and return received data from buffer */

	return UDR0;

}

void uart_puts(char *str)

{

	while(*str)

	{

		uart_transmit(*str++);

	}

}


int main()

{

	//DDRD = 0XFF;

	DDRC = 0XFF;

	//   sei();

	uart_init();

	lcd_init(LCD_DISP_ON);

	lcd_puts("SYSTEM INIT....");

	_delay_ms(500);

	lcd_clrscr();

	char kalpesh;

	while(1)

	{

		kalpesh = USART_Receive();

		//   lcd_putc(kalpesh);

		for(z=0;z<300;z++)

		{

			NMEA[z] = kalpesh;

		}

		lcd_putc(NMEA[0]);

	}
}

 

The output windows is:

 

------ Build started: Project: Neo GPS from AVRfreaks username asking, Configuration: Debug AVR ------

Build started.

Project "Neo GPS from AVRfreaks username asking.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking.cproj" (target "Build" depends on it):

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils

C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 

Building file: .././main.c

Invoking: AVR/GNU C Compiler : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include" -I"../../../../../Other Libraries/Peter Fleury LCD With FULL INSTRUCTIONS"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

Finished building: .././main.c

Building target: Neo GPS from AVRfreaks username asking.elf

Invoking: AVR/GNU Linker : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe" -o "Neo GPS from AVRfreaks username asking.elf"  main.o   -Wl,-Map="Neo GPS from AVRfreaks username asking.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega328p"  

main.o: In function `main':

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(137,1): error: undefined reference to `lcd_init'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(139,1): error: undefined reference to `lcd_puts'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(143,1): error: undefined reference to `lcd_clrscr'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(163,1): error: undefined reference to `lcd_putc'

collect2.exe(0,0): error: ld returned 1 exit status

make: *** [Neo GPS from AVRfreaks username asking.elf] Error 1

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\Debug\Makefile(113,1): error: recipe for target 'Neo GPS from AVRfreaks username asking.elf' failed

The command exited with code 2.

Done executing task "RunCompilerTask" -- FAILED.

Done building target "CoreBuild" in project "Neo GPS from AVRfreaks username asking.cproj" -- FAILED.

Done building project "Neo GPS from AVRfreaks username asking.cproj" -- FAILED.

 

Build FAILED.

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are lcd.h and lcd.c in the library folder or the current folder?

If in the current folder, it should be #include "lcd.h" not #include <lcd.h>

 

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think no. I have it in Toolchain/ AVR/GNU C compiler/ Directories (Look picture I attached)

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you try #include "lcd.h" ?

The error is saying it can not find the lcd.h file...

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I tried and give me:

 

------ Build started: Project: Neo GPS from AVRfreaks username asking, Configuration: Debug AVR ------

Build started.

Project "Neo GPS from AVRfreaks username asking.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking.cproj" (target "Build" depends on it):

Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application\AvrGCC.dll".

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils

C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 

Building file: .././main.c

Invoking: AVR/GNU C Compiler : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include" -I"../../../../../Other Libraries/Peter Fleury LCD With FULL INSTRUCTIONS"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

Finished building: .././main.c

Building target: Neo GPS from AVRfreaks username asking.elf

Invoking: AVR/GNU Linker : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe" -o "Neo GPS from AVRfreaks username asking.elf"  main.o   -Wl,-Map="Neo GPS from AVRfreaks username asking.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,-L"C:\Users\Josep\Documents\Other Libraries\Peter Fleury LCD With FULL INSTRUCTIONS"  -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega328p"  

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\Debug\Makefile(113,1): error: recipe for target 'Neo GPS from AVRfreaks username asking.elf' failed

main.o: In function `main':

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(137,1): error: undefined reference to `lcd_init'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(139,1): error: undefined reference to `lcd_puts'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(143,1): error: undefined reference to `lcd_clrscr'

C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking\Neo GPS from AVRfreaks username asking\main.c(163,1): error: undefined reference to `lcd_putc'

collect2.exe(0,0): error: ld returned 1 exit status

make: *** [Neo GPS from AVRfreaks username asking.elf] Error 1

The command exited with code 2.

Done executing task "RunCompilerTask" -- FAILED.

Done building target "CoreBuild" in project "Neo GPS from AVRfreaks username asking.cproj" -- FAILED.

Done building project "Neo GPS from AVRfreaks username asking.cproj" -- FAILED.

 

Build FAILED.

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Could it be the old problem of spaces in the path names?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The path name I copy& paste to Toolchain/ AVR/GNU C compiler/ Directories  is the same of the real library.

 

Then Atmel Studio program did a change writing  the path directory writing ../../../ automaticaly.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Even though spaces are legal in Windows file and directory names, some programs to not handle spaces properly. Nothing in a path name should have a space in it it! In some cases, using double-quotes ( I think that is it) will "solve" the problem. Search the internet to find out.

 

Jim

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Thu. Dec 7, 2017 - 10:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Even though spaces are legal in Windows file and directory names, some programs to not handle spaces properly. 

Surprisingly, we haven't had that one for a while now:

 

http://www.avrfreaks.net/comment...

 

Quote:
Simple rule: Never use spaces nor any other "special" characters (including ampersand '&', punctuation, etc) in file or folder names.
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
What library should I use for not have any compiler error?

The problem is not in the library - it's in you not configuring your project properly for it.

 

The Arduino IDE does all this for you - so, as previously suggested, why not just use that?

 

Otherwise, you need to take a few steps back and start with the basics of how to set up & configure an Atmel Studio project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Better rename all files and directories replacing spaces by underscores, and try again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is lcd.c at all added to the project? I see not compilation command for it in the build output above.

 

(Or am I blind? Did anybody else actually inspect the build output?)

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
 I see not compilation command for it in the build output above.

likewise - main seems to be the only thing being built.

 

Also, despite the general warning about spaces, etc, in file/folder names, that doesn't seem to be causing a problem here.

Yet ...

 

I did note that there seem to be some rather long names. Again, not causing a problem yet - but this can also upset windows-based stuff...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

The Arduino IDE does all this for you - so, as previously suggested, why not just use that? 

 

I can not do it with Arduino. It is not may decision. I have to follow somebody rules, he said me that I can not do it with Arduinos. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Navidulce wrote:
I can not do it with Arduino. It is not may decision. I have to follow somebody rules, he said me that I can not do it with Arduinos. 

Fair enough.

 

You could have mentioned that!

 

So, if "somebody" is telling you to use Atmel Studio, you should go to that person for help in setting it up!

 

EDIT

 

So my comment in #20 applies:

 

you need to take a few steps back and start with the basics of how to set up & configure an Atmel Studio project.

 

Possibly, even, in the general concepts of multi-file 'C' projects?

 

See: [TUT] Modularizing C Code: Managing large projects

 

 And: http://c-faq.com/decl/decldef.html

Last Edited: Fri. Dec 8, 2017 - 09:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Is lcd.c at all added to the project? I see not compilation command for it in the build output above.
+10

 

There's no real mystery here. To use "library" code like this you just have to do two things:

 

1) you add a #include of the .h file to the top of the file where you plan to call the library functions

 

2) you add the .c file that provides the library functionality to the list of files in the Solution/Project you are building so that it will be compiled and linked with the file where you call those functions

 

Clearly you have not done 2.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
you just have to do two things

Actually, there's a third:

 

3. Configure your toolchain's "Include Paths" - so that it knows where to find the header(s) ...

 

EDIT

 

You might be "lucky" (sic?) if your project already just happens to be looking in the place where you put the header(s) - but, in general, this is something that you need to configure.

Last Edited: Fri. Dec 8, 2017 - 09:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

Better rename all files and directories replacing spaces by underscores, and try again.

 

 

I remove all space less the directory of Atmel Studio (because Atmel Studio setup.exe create the it this way by default ).

C:\Users\Josep\Documents\Atmel Studio

 

My Output tab is:

------ Build started: Project: Neo_M6_GPS_Code_From_AVRfreaks, Configuration: Debug AVR ------

Build started.

Project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks.cproj" (target "Build" depends on it):

Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application\AvrGCC.dll".

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils

C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 

Building file: .././main.c

Invoking: AVR/GNU C Compiler : 4.3.3

"C:\WinAVR-20100110\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include" -I"../../../../../Other_Libraries/Peter_Fleury_LCD_With_Full_INSTRUCTIONS"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall  -mmcu=atmega328p  -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Debug\Makefile(79,1): error: recipe for target 'main.o' failed

In file included from .././main.c:45:

c:\users\josep\Documents\Other_Libraries\Peter_Fleury_LCD_With_Full_INSTRUCTIONS\lcd.h(49,2): error: #error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"

make: *** [main.o] Error 1

Done executing task "RunCompilerTask" -- FAILED.

Done building target "CoreBuild" in project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" -- FAILED.

Done building project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" -- FAILED.

 

Build FAILED.

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

 

 

 

So I have to install AVR-GCC 4.5 or later, update to newer AVR

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you not read #22 and #23?

 

EDIT

 

And #26

 

Which all seems to come down to #25 ...

Last Edited: Fri. Dec 8, 2017 - 09:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Is lcd.c at all added to the project? I see not compilation command for it in the build output above.

 

(Or am I blind? Did anybody else actually inspect the build output?)

 

 

awneil wrote:

Also, despite the general warning about spaces, etc, in file/folder names, that doesn't seem to be causing a problem here.

Yet ...

 

I did note that there seem to be some rather long names. Again, not causing a problem yet - but this can also upset windows-based stuff...

 

 

 

Maybe it can be because I saved a .txt with some old versions of the programs I am trying to work, in the directory:

 C:\Users\Josep\Documents\Atmel Studio\7.0\Neo GPS from AVRfreaks username asking

 

 

 

awneil wrote:

Did you not read #22 and #23?

 

Yes, now I read.

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
Invoking: AVR/GNU C Compiler : 4.3.3
Navidulce wrote:
#error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"

So that seems pretty clear to me.

 

4.3.3 is "WinAVR". That is compiler from 8 years ago. Why are you still using that?

 

Your build output LOOKS like it comes from Atmel Studio 7. That came with a perfectly valid avr-gcc which may be 4.9.2 or even a 5.x version so why have you reverted to use the 8 year old WinAVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Is lcd.c at all added to the project? I see not compilation command for it in the build output above.

 

(Or am I blind? Did anybody else actually inspect the build output?)

 

Well I have the lcd.c in C:\Users\Josep\Documents\Other Libraries\Peter Fleury LCD With FULL INSTRUCTIONS

As you can see in pictures I attached it.

 

So, My answer is yes the lcd.c is added to the project

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
he said me that I can not do it with Arduinos. 

So if he's insisting that you use Atmel Studio, get him to show you how to use it properly!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are confusing the term "library". These lcd.h and lcd.c files are NOT a "library" in the usual computing sense of the word. The term "library" usually means a pre-compiled static binary library such as libm.a, libprintf_flt.a or other lib<something).a file.

 

The lcd.c and lcd.h you have there are just some "additional source files" for your project. They are not a "library" (whatever they may try to call themselves!) so just treat them as if they were your own source files. Put the .c and .h files in the same directory as the other .c and .h files in your program (for an easy life - worry about locating them somewhere else later). Then in the .c files where you will call the functions provided add a

#include "lcd.h"

and in the "Solution Explorer" for your project, under Source File, right click and use "Add"-"Existing Item.." and introduce lcd.c to the project and that is all that is required.

 

But you still face this 4.3.3 versus 4.5 issue you need to resolve first (by switching back to the compiler "flavour" that comes with AS7)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

4.3.3 is "WinAVR". That is compiler from 8 years ago. Why are you still using that?

 

 

I don't know. The first time I was  confused with so many software AVRdude, WinAVR and Atmel Studio. I installed all of this from internet. I didn't pay attencion to the version of WinAVR, But the HID of WinAVR I have installed it seemed old to my.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But AS7 is an editor, debugger AND compiler. So you didn't need to install anything but AS7 and you would have an up to date compiler. Somehow it appears you have managed to persuade it to use the old WinAVR instead. This is not a good choice in 2017 (almost 2018).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:
I don't know. The first time I was  confused with so many software AVRdude, WinAVR and Atmel Studio.

Again, if you've been directed to use these tools you should be asking your teacher/manager or whoever directed you to show you how to use them!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Navidulce wrote:

JohanEkdahl wrote:

Is lcd.c at all added to the project? I see not compilation command for it in the build output above.

 

(Or am I blind? Did anybody else actually inspect the build output?)

 

Well I have the lcd.c in C:\Users\Josep\Documents\Other Libraries\Peter Fleury LCD With FULL INSTRUCTIONS

As you can see in pictures I attached it.

 

So, My answer is yes the lcd.c is added to the project

 

I'm not talking about if the file exists in the file system.

 

I am talking about adding it to the project setup in Atmel Studio. In the Solution Explorer there is a tree view showing all files involved in the project. Some are added by you the user, others are deduced by Studio. Now, note this: Just because you do

#include "lcd.h""

in your main.c this does not mean that Studio knows it needs to compile lcd.c. You need to tell Studio that this has to be done.

 

Can you, among all those files, find lcd.c? I suspect it is not there, and thus Atmel Studio will never compile it and thus the linker will never find any compiled version of the functions in it.

 

If it is not there, right click on the parent node of main.c, select Add existing item in the menu, browse to lcd.c (not .h but .c !!) and click OK. Rebuild. Show us the build output.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I not change the update the AVR-GCC 4.5 or later.

 

There is a command I have to write in Windows terminal for update the AVR-GCC? Or how I have to do it?

I should remove the WinAVR, before update the AVR-GCC?

 

I changed the adanced Toolschain flavours to default instead of WinAVRDev I had.

 

I added in the Solution Explorer the lcd.c , I did it from: Add/Existing item 

 

With Toolschain/ AVR/GNU C compiler directory: C:\Users\Josep\Documents\Other_Libraries\Peter_Fleury_LCD_With_Full_INSTRUCTIONS 

The output tab is:

 

 

------ Build started: Project: Neo_M6_GPS_Code_From_AVRfreaks, Configuration: Debug AVR ------

Build started.

Project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks.cproj" (target "Build" depends on it):

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils

C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 

Building file: .././main.c

Invoking: AVR/GNU C Compiler : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include" -I"../../../../../Other_Libraries/Peter_Fleury_LCD_With_Full_INSTRUCTIONS"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

Finished building: .././main.c

Building target: Neo_M6_GPS_Code_From_AVRfreaks.elf

Invoking: AVR/GNU Linker : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe" -o Neo_M6_GPS_Code_From_AVRfreaks.elf  lcd.o main.o   -Wl,-Map="Neo_M6_GPS_Code_From_AVRfreaks.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p  

Finished building target: Neo_M6_GPS_Code_From_AVRfreaks.elf

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures  "Neo_M6_GPS_Code_From_AVRfreaks.elf" "Neo_M6_GPS_Code_From_AVRfreaks.hex"

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom  --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0  --no-change-warnings -O ihex "Neo_M6_GPS_Code_From_AVRfreaks.elf" "Neo_M6_GPS_Code_From_AVRfreaks.eep" || exit 0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "Neo_M6_GPS_Code_From_AVRfreaks.elf" > "Neo_M6_GPS_Code_From_AVRfreaks.lss"

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Neo_M6_GPS_Code_From_AVRfreaks.elf" "Neo_M6_GPS_Code_From_AVRfreaks.srec"

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "Neo_M6_GPS_Code_From_AVRfreaks.elf"

   text    data     bss     dec     hex filename

    662      16     645    1323     52b Neo_M6_GPS_Code_From_AVRfreaks.elf

Done executing task "RunCompilerTask".

Task "RunOutputFileVerifyTask"

Program Memory Usage : 678 bytes   2,1 % Full

Data Memory Usage : 661 bytes   32,3 % Full

Done executing task "RunOutputFileVerifyTask".

Done building target "CoreBuild" in project "Neo_M6_GPS_Code_From_AVRfreaks.cproj".

Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').

Target "Build" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Avr.common.targets" from project "c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks.cproj" (entry point):

Done building target "Build" in project "Neo_M6_GPS_Code_From_AVRfreaks.cproj".

Done building project "Neo_M6_GPS_Code_From_AVRfreaks.cproj".

 

Build succeeded.

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

 

 

 

 

 

 

 

 

WITHOUT Toolschain/ AVR/GNU C compiler directory: C:\Users\Josep\Documents\Other_Libraries\Peter_Fleury_LCD_With_Full_INSTRUCTIONS 

The output tab is:

 

 

 

------ Build started: Project: Neo_M6_GPS_Code_From_AVRfreaks, Configuration: Debug AVR ------

Build started.

Project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks.cproj" (target "Build" depends on it):

Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application\AvrGCC.dll".

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils

C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync 

Building file: .././lcd.c

Invoking: AVR/GNU C Compiler : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -c -std=gnu99 -MD -MP -MF "lcd.d" -MT"lcd.d" -MT"lcd.o"   -o "lcd.o" ".././lcd.c" 

In file included from .././lcd.c:28:0:

c:\program files (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h(92,3): warning: #warning "F_CPU not defined for <util/delay.h>" [-Wcpp]

# warning "F_CPU not defined for <util/delay.h>"

   ^

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\lcd.c(29,17): error: lcd.h: No such file or directory

compilation terminated.

make: *** [lcd.o] Error 1

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Debug\Makefile(86,1): error: recipe for target 'lcd.o' failed

make: *** Waiting for unfinished jobs....

Building file: .././main.c

Invoking: AVR/GNU C Compiler : 5.4.0

"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c" 

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\main.c(45,17): error: lcd.h: No such file or directory

compilation terminated.

make: *** [main.o] Error 1

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\Debug\Makefile(86,1): error: recipe for target 'main.o' failed

Done executing task "RunCompilerTask" -- FAILED.

Done building target "CoreBuild" in project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" -- FAILED.

Done building project "Neo_M6_GPS_Code_From_AVRfreaks.cproj" -- FAILED.

 

Build FAILED.

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like you just need to start again from scratch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is getting confusing, and you seem to be starting to "shoot from the hip". That is never a good strategy.

 

You have several problems coming and going when you meddle with settings etc.

 

FIRST: Set the used toolchain to use the one that came with Atmel Studio. This is (at least a reasonably) up-to-date tool chain. 

 

THEN: Start solving the other problems. From the latest build output this seems to be that the file lcd.h is not found. Make sure your include search paths in the Studio project are set up correctly. Make sure the file exists in the place where you expect it to be.

 

It's hard to tell exactly how your project is set up merely by communicating here in text. The build outputs are good for us to  see but we use them to infer (or speculate about) what is wrong. Our guesses might be bad. There might be facts that are not seen in the build output. Etc etc.. One alternative way of letting us help you would be if you ZIPped up the complete project folder tree and posted it here as an attachment so that we could have a look.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

c:\users\josep\Documents\Atmel Studio\7.0\Neo_M6_GPS_Code_From_AVRfreaks\Neo_M6_GPS_Code_From_AVRfreaks\lcd.c(29,17): error: lcd.h: No such file or directory

compilation terminated.

Again this is unequivocal. It's saying that lcd.c at line 29 column 17 has #include "lcd.h" but the preprocessor cannot see a file of that name in the directory where lcd.c is located - so is it there?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi JohanEkdahl

 

I attached my application PRG.

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A piece of Output terminal:

(29,17): error: lcd.h: No such file or directory compilation terminated.

 

The line of my main.c:

45      #include "lcd.h"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I just told you that in #42. My question was "is the lcd.h in the same directory as the lcd.c that is trying to use it?". Also are those files in the same directory as main.c ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Have a look in the ZIP file in post #43, Cliff. There's no sign of any lcd.h in that ZIP.

 

I suggest to Navidulce to take a long refreshing walk, and have some sleep. Then come back to the problem with a fresh and ventilated brain and work with this in a structured manner.

 

Right now it just seems like a lot of "shooting from the hip", and it is getting painful since our advice are either not read or mis-read.

 

I told you in #41 to

Make sure the file exists

which you obviously didn't. It's not in the project you zipped up and attached in #43.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. Dec 8, 2017 - 12:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
I suggest to Navidulce to take a long refreshing walk, and have some sleep.

Absolutely!

 

Then come back to the problem

Don't even come back to the problem yet.

 

Go to the Atmel Studio website

 

http://www.atmel.com/microsite/atmel-studio/

 

https://www.microchip.com/avr-support/atmel-studio-7

 

Spend time studying the introductory tutorials & videos - there's a whole load of "Getting Started with Atmel Studio" videos at the bottom of the Microchip page.

 

Also

 

http://www.atmel.com/microsite/atmel-studio/videos.aspx

 

Then create a simple, single-file "blinly" program.

 

Then try to add a second .c file and header.

 

Having done that, you should be properly prepared to successfully tackle this project.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Posted by clawson: Fri. Dec 8, 2017 - 12:28 PM
I just told you that in #42. My question was "is the lcd.h in the same directory as the lcd.c that is trying to use it?". Also are those files in the same directory as main.c ?

My answer for the first question is yes, and the answer of the second, is no.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

If the .h file(s) aren't in the same directory as the .c file(s) that #include them then you

  • either need to specify the path in the #include directive (clumpsy solution),
  • or add the directory with the .h file(s) to your include paths in the project setup (good solution for large projects with many source files)

 

BUT, since your project is trivial, in the sense that there are only a few files involved, the easiest way is not to do any of the above but instead

  • Place all your source files (i.e. lcd.h and lcd.c) in the same directory as your main.c.

 

That way the compiler will find the .h file with a simple

#include "lcd.h"

in your .c files (both main.c and lcd.c).

 


 

And returning to the ZIP file you attached in a previous post, there is no lcd.h file at all in the directory tree. It is very unwise, especially so as a beginner, to have files outside the project directories that actually are referenced by the project. This is one source for confusion, and since you're starting out and have enough things to think about anyway, and should be avoided.

 

So again: Place all source files (.c and .h) in the same directory as the main.c file. Do simple includes without any paths in them - just the filenames.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When Andy said...

awneil wrote:

clawson wrote:
you just have to do two things

Actually, there's a third:

 

3. Configure your toolchain's "Include Paths" - so that it knows where to find the header(s) ...

 

EDIT

 

You might be "lucky" (sic?) if your project already just happens to be looking in the place where you put the header(s) - but, in general, this is something that you need to configure.

I thought "not really, this project is surely so simple that all the files will be in the same place so the #include's will just be found as "current directory" is always searched". Seems I was wrong.

 

I had wondered if there's any chance that this trivially simple activity will be resolved by #50 ??

Last Edited: Fri. Dec 8, 2017 - 01:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I had wondered if there's any chance that this trivially simple activity will be resolved by #50 ??

were you including the 19 posts already in the other thread ... ?

 

frown

Pages