cmake引用jansson库
描述
在ubuntun系统上使用clion开发c程序, cmake如何引入jansson库.
下载jansson
wget http://digip.org/jansson/releases/jansson-2.13.tar.gz tar -xvf
编译jansson
cd jansson-2.13 mkidr build cd build cmake ../ make
查看编译结果
├── include │ ├── jansson_config.h │ └── jansson.h ├── lib │ └── libjansson.a
clion创建C程序
File->New->Project->选中"C Executable"
CMakeLists.txt引用jansson
cmake_minimum_required(VERSION 3.22) project(demo_task C) set(CMAKE_C_STANDARD 11) #自定义库, jansson放在了source目录下 set(LIBHOME "/home/xxx/workspace/source/") # jansson include_directories(${LIBHOME}/jansson-2.13/build/include) link_directories(${LIBHOME}/jansson-2.13/build/lib) link_libraries(jansson) add_executable(demo_task main.c)
main.c使用jansson
创建demo.json并放入任意json数据, jansson读取demo.json,并打印结果
#include <stdio.h> #include <jansson.h> int main() { json_t *json; json_error_t error; json = json_load_file("../demo.json", 0, &error); if(!json) { /* the error variable contains error information */ } char *result = json_dumps(json, 0); printf("%s\n", result); free(result); return 0; }
运行
clion运行并查看结果
2024年1月10日 13:29
Pavzi.com provides all the news about Gadgets, the Economy, Technology, Business, Finance and many more. The main concept or our aim behind this website has been the will to provide resources with full information on each topic which can be accessed through the Internet. To ensure that every reader gets what is important and worthy about the topic they search and link to hear from us. pavzi.com Our site is a multiple Niche or category website which will ensure to provide information and resources on each and every topic. Some of the evergreen topics you will see on our website are Career, Job Recruitment, Educational, Technology, Reviews and others. We are targeting mostly so it is true that Tech, Finance, and Product Reviews. The only reason we have started this website is to make this site the need for your daily search use.
2024年1月10日 14:33
Thank you for providing the references on incorporating the Jansson library into CMake projects. Your guidance on using CLion for C development on Ubuntu has been incredibly helpful. I've successfully integrated the Jansson library into my project, and it's working seamlessly.
2024年1月23日 23:03
Metaverse games have long exceeded the stage of being a trend, with several games now having market capitalizations above $1 Billion.. casino online
2024年1月25日 20:19
The GDP (Gross Domestic Product) of the 41 Heavily Indebted Poor Countries (567 million people) is less than the wealth of the world’s 7 richest people combined. madrasah ibtidaiyah al muhajirin
2024年1月27日 00:55
Amusing article. It seems that most of the ways are depending on the creative thinking aspect. “All marriages are mixed marriages.” by Chantal Saperstein.. 홈카지노검증
2024年2月14日 17:23
Spiritual guidance is the ability to receive messages from a higher source that can give us insight into our lives. It can be received in a variety of ways, including meditation, prayer, and by connecting with your spirit guides. You can also receive guidance from others in your life or through ordinary coincidences, such as seeing a light around the correct answer on a multiple-choice exam.. what does it mean to dream about a female coworker
2024年2月14日 22:04
I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. bestoto
2024年2月16日 01:51
MusicVerter is a free SoundCloud to MP3 downloader. Download any SoundCloud song or playlist directly into an MP3 file for free with just one click. Try it now! SoundCloud Downloader - SoundCloud To MP3 Converter. soundcloud downloader
2024年2月24日 19:56
Al Masaood Tyres is a premier destination for all your tire needs in Abu Dhabi, known for its exceptional service and extensive range of top-tier tire brands. With a team of skilled professionals, they provide expert advice and efficient solutions to ensure your vehicle's optimal performance and safety on the road.
2024年3月06日 03:53
The 10 Deep hoodie is an absolute must-have! The quality and comfort of this hoodie are unmatched, making it perfect for any casual or streetwear look. 10 deep hoodie
2024年3月13日 01:19 I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. gmail.com login
2024年3月19日 14:03
Thai-Move is a web based search platform which allows people from anywhere in the world to search for any type of property in Thailand. Agents from all over Thailand can list all of their properties easily and in one place giving the people searching the ability to not only search for everything without switching websites, but be able to save and compare one property to the next.
2024年3月19日 16:52
מחפשים נעלי נייק ? אצלנו במול שוז אתם במקום הנכון לנעלי נייק גברים, נייק נשים או ילדים! באתר תמצאו מגוון דגמי נעלי ספורט נייק לפעילויות שונות כגון כדורגל, כדורסל, , טניס ועוד. זקוקים לייעוץ בנוגע לבחירת נעלי נייק? צרו עימנו קשר !
2024年3月19日 19:36
Imagine approaching a flame-haired beauty with a playful grin and saying, "Is it just me, or is it getting hotter in here? Oh wait, it's just your fiery locks stealing all the attention." This line not only acknowledges the unique allure of red hair but also serves as a lighthearted compliment, sure to bring a smile to their face and spark a conversation.
2024年3月29日 09:33
Educational apps are invaluable tools for modern learners of all ages. With their interactive features and diverse content, these apps make learning accessible anytime, anywhere. <a href="https://takesapp.com/top-10-educational-apps-for-kids/">educational apps</a>
2024年4月21日 00:11
Limousine Dubai offers unparalleled luxury and comfort for your transportation needs in the vibrant city of Dubai. <a href="https://www.limousinedxb.com/">Limousine Dubai</a>
2024年4月30日 00:59
Our Services Need help with locks? MyKey Locksmith has you covered! Our professional team of locksmiths are here to provide reliable, fast, and trustworthy service.
2024年5月02日 21:18
Experience spacious floor plans and exceptional on-site management and maintenance at Renewal Heights Apartments. Your comfort and satisfaction are paramount to us. Indulge in our recently renovated units, boasting energy-efficient windows, thermal siding, and modernized LED lighting.
2024年5月03日 01:27
Rama Siding is a professional siding contractor based in Toronto, servicing the GTA for over 25 years. A father and son business focused on providing value and ensuring that every customer we serve is satisfied.
2024年5月03日 06:30
We’re an explainer video production company with the passion to create storytelling videos that deliver engaging and compelling content. Our animated explainer video production services deliver engaging video content for businesses and nonprofits. We make video explainers that engage your audience, increase conversions, and boost your bottom line. <a href="https://explainervideos.ca">animated video production cost</a>
2024年5月10日 07:18
Their journey from ancient repositories of scrolls to modern digital archives is a testament to their enduring significance in shaping the intellectual landscape of society.
2024年6月18日 08:56
This is a fabulous post I seen because of offer it. It is really what I expected to see trust in future you will continue in sharing such a mind boggling post Veelgestelde vragen over visa voor Cambodja
2024年6月21日 00:39
Unlock the Potential of Candidates with 100+ Professional Assessment Tests Our platform offers a range of professional tests to evaluate candidate skills and suitability, helping you make informed hiring decisions.
2024年6月28日 05:03
As a billing consultant, we have assisted providers and facilities in solving medical billing problems and increasing their cash flow and reducing cost. [url=https://atozbillings.com/]Revenue cycle management[/url]
2024年6月28日 19:12
I am impressed with the high quality and fit of the suit I ordered from America Jackets. Highly recommended! Next, I’ll be ordering Ryan Reynolds Shearling Jacket from them.
2024年7月06日 23:06
Playwell's success has come about by understanding customers' needs, listening to comments and suggestions, and by providing quality goods at competitive prices. As technology advances, so do the pressures brought about by increased expectations of performance and productivity.
2024年7月08日 00:35
Is the 토지노 membership registration process complicated?
2024年7月08日 20:11
Whether you need a car key replacement, a remote keyless entry system, a car fob programming, or a car lockout service, we can help you with any of your auto locksmith needs.
2024年7月09日 12:32
Rama Siding is a professional siding contractor based in Toronto, servicing the GTA for over 25 years. A father and son business focused on providing value and ensuring that every customer we serve is satisfied.
2024年7月15日 16:49
Seeking <a href="https://ukassignmentwritershelp.co.uk/">uk assignment writers help</a> ensures that students receive personalized guidance and support in the completion of their academic tasks. These professionals offer expertise in various subjects, ensuring assignments are not only completed on time but also meet rigorous academic standards. Partnering with reputable services can significantly enhance your learning experience by providing valuable insights and improving overall academic performance.
2024年7月20日 15:32
We revolutionised the way companies assess their workplace risks and prepare their Risk Assessment and bizSAFE documentation.
2024年7月22日 19:34
SS Scaffolding is a reliable and professional scaffolding company with over 30 years of experience providing residential and commercial scaffolding services all across Sydney including north shore, south east, west and central Sydney.
2024年8月01日 18:57
Our Services Need help with locks? MyKey Locksmith has you covered! Our professional team of locksmiths are here to provide reliable, fast, and trustworthy service.
2024年8月20日 14:15
The Reference Jansson library is a robust tool for managing JSON data in C, with a simple API and fast performance. It is very handy for developers who need to manage complicated data structures in their projects. For individuals working on academic research, like a <a href="https://thedissertationhelp.co.uk/ph-d-dissertation-writing-service/"> phd dissertation help </a>this library can be a wonderful aid in processing and storing data.
2024年9月05日 16:48
I offer mixed flat-rate 1 hour treatment, including: traditional acupuncture, gua sha, cupping, electro-acupuncture, auricular acupuncture, depending on your health condition.
2024年9月09日 19:36
News coverage of cultural heritage, including the preservation of historical sites, traditions, and languages, plays a crucial role in promoting cultural preservation. By highlighting the importance of preserving cultural heritage, news organizations can inspire public interest and support for preservation efforts. Journalists covering cultural preservation must have a deep understanding of the subject matter and a commitment to providing accurate and respectful reporting. Effective cultural preservation journalism can contribute to the protection of cultural heritage and the promotion of cultural diversity.<a href="https://derbynewsjournal.com">News</a>
2024年9月10日 15:29
At Raw Power Electric, we specialize in the installation, maintenance, and repair of electrical systems in homes, businesses, and factories. Our expert team can troubleshoot electrical issues, plan electrical systems, and inspect and maintain circuit breakers and transformers while ensuring compliance with all laws and building codes
2024年9月19日 15:20
Del Valle Pest Control provides affordable residential and commercial termite and pest control services in McAllen, TX. Call us 956-433-3348.
<a href="https://delvallepestcontrol.com/">delvallepestcontrol</a>
2024年10月03日 18:33
I’m absolutely delighted with the exceptional quality and perfect fit of the suit I ordered from Zellberry. I highly recommend them! Next on my list is the Plus Size Convertible Collar Leather Jacket.
2024年10月06日 13:35
I like this post so much, and all the details are in this post is very impressive.
#1 rated <a href="https://www.sydneytoptours.com/sydney-city-tour/" >Sydney City Tour</a>, Australia - Explore Sydney's hidden gems, and uncover iconic landmarks & local secrets. Book now!