Importing Mavlink into Atmel Studios 7

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey guys, I was hoping someone could help me with importing this library. When I follow the guide,  https://mavlink.io/en/mavgen_c/ , it says add to your project and then just use #include. I've tried adding it as a library, and tried moving it into the same location as my c file, but it doesn't recognize the #include. Also how would I go about creating a parent dialect and adding it? Thank you in advance!

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

You #include header files and you "add" code files to the project by right-clicking on the project name in the solution explorer.

 

Not sure what you do about assembler files.

 

Jim

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

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

In the link that you posted, it shows:

   #include <your_dialect/mavlink.h>

 

If you are using Studio 7, using the < ... > is wrong.

 

Try using " ... " instead.

   #include "your_dialect/mavlink.h"

 

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

Thank you for the suggestion, I tried adding existing file already and I tried once more but it does not work unfortunately.

Last Edited: Sun. Mar 15, 2020 - 03:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the suggestion, I changed it to " " and it still did not work unfortunately. 

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

What are the reported errors? You can copy from the error window and paste into your Freaks message.

 

Jim

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

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

When I do #define "common/mavlink.h"

 

Severity    Code    Description    Project    File    Line
Error        recipe for target 'main.o' failed    C    C:\Users\Chris\Documents\junior_design\C\C\Debug\Makefile    76
Error        common/mavlink.h: No such file or directory    C    C:\Users\Chris\Documents\junior_design\C\C\main.c    2
 

 

When I do #define "common.h"

Severity    Code    Description    Project    File    Line
Error        #error Wrong include order: MAVLINK_COMMON.H MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set ALL AND EVERY defines from MAVLINK.H manually accordingly, including the #define MAVLINK_H call.    C    C:\Users\Chris\Documents\junior_design\C\C\common.h    10
Error        ../protocol.h: No such file or directory    C    C:\Users\Chris\Documents\junior_design\C\C\common.h    30
Error        recipe for target 'main.o' failed    C    C:\Users\Chris\Documents\junior_design\C\C\Debug\Makefile    76
 

 

When I do #define "mavlink.h"

 

Severity    Code    Description    Project    File    Line
Error        recipe for target 'main.o' failed    C    C:\Users\Chris\Documents\junior_design\C\C\Debug\Makefile    76
Error        version.h: No such file or directory    C    C:\Users\Chris\Documents\junior_design\C\C\mavlink.h    31
 

https://imgur.com/a/D1hryPl

 

https://imgur.com/a/eKdBSw9

 

 

I just tried this and got this error 

#define "common/mavlink.h"

https://imgur.com/a/2wHAdUr

 

Severity    Code    Description    Project    File    Line
Error        recipe for target 'C.elf' failed    C    C:\Users\Chris\Documents\junior_design\C\C\Debug\Makefile    106
Error        cannot find -lcommon.h    C        1
Error        cannot find -lmavlink.h    C        1
Error        ld returned 1 exit status    C    collect2.exe    0

 

Last Edited: Sun. Mar 15, 2020 - 06:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not #define. That is for macros.

 

#include "common/mavlink.h"

 

The IDE might not like locating in a subfolder but have not tried it.

 

Also, note that the IDE uses "\" which is the Windoze symbol. So, you might want to

 

#include "common\mavlink.h"

Jim

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

Last Edited: Sun. Mar 15, 2020 - 08:45 PM