Rtklib Dynamic Library compilation under Eclipse framework

Source: Internet
Author: User
Tags function definition mathematical functions

1. Preface

The rtklib is the Standard & Precision Location Open source package for the GNSS Global Navigation Satellite system , including a rich range of navigation and positioning algorithm applications, communication protocol interfaces, and various function libraries API, specific content can refer to the author's blog "rtklib compilation and RTCM data reading sample. "

The rtklib Dynamic Library compilation Bovendo currently circulating on the Web is based on the Microsoft Visual Studio Framework, mainly because people are accustomed to using the Microsoft Windows operating system, and Rtklib is essentially a cross-platform navigation and positioning library that runs more robustly under a Linux or Unix system and makes it easier to compile and develop. Therefore, the author studies the problem of rtklib Dynamic Library compiling under Eclipse Framework, and gives some practical examples for the reference of navigation algorithm researchers and software developers.

2 . rtklib compilation based on Eclipse framework

The first step in Rtklib compilation based on the Eclipse framework is to build the build environment, the author uses the Ubuntu18.04 desktop version, the version of the IDE that is used is Eclipse oxygen.3a Release (4.7.3a), the specific compilation environment developers can make the appropriate adjustments, not to repeat this.

After you have built the IDE, you can compile your code, with the following steps:

(1) Create Project. Create a new C Managed build project in the Eclipse IDE environment, fill in the project name and Project save path, select the project type and compile tool, fill in the engineering basic information, set the project configuration information,1 to Figure 4. In the construction project, I named the project Rtklibdemo, the Hello World ANSI C Project executable template and the linux gcc compiler, the project configuration properties are in the IDE default properties, no changes have been made, Follow the compilation needs to make corresponding adjustments. Beginners can be modeled, or can be pre -configured with the appropriate options for advanced settings.

Figure 1 new C Managed build Project

Figure 2 Setting the project name, project path, project type, and compiler

Figure 3 Setting the project's basic information

Figure 4 Setting up project configuration information

(2) Import rtklib source file. rtklib source files currently have two branches on GitHub, the latest version is the rtklib 2.4.3 b29 version (updated on 2017/09/02) and Rtklib 2.4.2 p13 version (Updated 2018/01/30), where the Rtklib 2.4.2 version contains the relevant source code for the PPP location navigation algorithm, Developers can choose their own as needed. After the download is complete, right-click the import source file in the Eclipse Project Project src folder tab, select File System in the popup screen box, navigate to the rtklib source file folder, select all c files, click The Finish button is available, asshown in 5,6.

Figure 5 Configuring Import Resources

Figure 6 Importing rtklib source files

(3) compile rtklib. After you finish importing the source file, clicking Compile Eclipse ide will prompt "fatal error:rtklib.h:no such file or directory" error,7. The reason is that the rtklib source code will be the various manufacturers of data decoding functions in the Rcv folder, and the header file rtklib not the same folder, the author adopts the correct strategy is to RCV all the C files in the folder #include "rtklib.h" Unified update to #include ". /rtklib.h "To circumvent the problem of header file path errors, asshown in 8.

Figure 7 rtklib.h header file path error

Figure 8 rtklib.h Header file path Error solution

Clicking Compile Eclipse IDE again will prompt "undefined reference to ' tan '" and other mathematical function definitions do not exist error, "undefined reference to ' Pthread_ Creat ' "such as thread function definitions do not have errors and"undefined reference to ' showmsg ' "functions such as no errors,9,10 are shown.

Figure 9 Mathematical functions and thread function definitions no errors exist

Figure "undefined reference to ' showmsg '" function without errors

The "Math function definition does not have an error" is because the gcc compiler lacks LIBM at compile time , the solution is to add the m library to the link library, as shown in11.

Figure 11 "Mathematical function definition no error" solution

"The thread function definition does not have an error" is because pthread is not the default library under Linux, at the time of linking, unable to find the Phread library in the entrance address of the elder brother function, the link failed. The solution is to add the-lpthread parameter to the GCC compiler , specifically to the Eclipse IDE, which is in the gcc C compiler Miscellaneous tab and the GCC C linker The General tab, check the "Supportfor Pthread (-lpthread)" option,shown in 12,13.

Fig. GCC C compiler-lpthread parameter configuration

Figure GCC C linker-lpthread parameter configuration

The "undefined reference to ' showmsg '" function does not have an error because there is no pre-defined "DLL" identity before compiling, which causes the function to not compile properly. The solution is to add a DLL pre-defined identity in Defined symbols in the GCC C compiler Preprocessor selector card , as shown in 14. (Note: A similar operation can be followed by predefined Enaglo,enacmp,trace, etc. to adjust The Rtklib library's functional scope.) )

Figure "undefined reference to ' showmsg '" function does not exist error solution

Clicking the compile Eclipse IDE again will prompt the compilation to be successful, indicating that the rtklib Dynamic Library compilation is basically complete and can invoke the relevant interface on this basis.

3. Application examples

Complete the Eclipse IDE environment Rtklib compiled, the author called the Rtklib in the package of serial communication interface function, to achieve a simple serial data communication function, the code is as follows:

1#include <stdio.h>2#include <stdlib.h>3#include"Rtklib.h"4 5 intMainvoid) {6     intopt[8] = {10000,10000, +,32768,Ten, +, -,0 };7     intstrs[1] ={str_serial};8     Doublenemapos[3] = {0 };9     Char*path[8],*cmd[4]={0},*cmds_p[4]={0};Tenstrconv_t *conv[4] = {0 }; One  Astrsvr_t *svr = (strsvr_t *) malloc (sizeof(strsvr_t)); -      for(inti =0; I <1; i++) -Path[i] = (Char*) malloc (sizeof(Char) *1024x768); the  -printf"Please input the device name:"); -scanf"%s", path[0]); -  +Strsvrinit (SVR,0); - Strsvrstart (SVR, opt, STRs, path, conv, cmd, cmds_p, nemapos); +  AUnsignedintNpb0 =0; at      while(1) -     { -Strlock (&svr->stream[0]); -          for(unsignedinti =0; I < svr->stream[0].inb-npb0; i++) -         { -printf"%c", svr->buff[i]); in         } -         if(Npb0 < svr->stream[0].inb) { toNpb0 = svr->stream[0].inb; +         } -  theStrunlock (&svr->stream[0]); *Sleepms (1); $     }Panax Notoginseng     returnexit_success; -}

Rtklib Dynamic Library compilation under Eclipse framework

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.