Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4536206
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:30:16+00:00 2026-05-21T14:30:16+00:00

I have recently decided to use yaml as my configuration file technology, and am

  • 0

I have recently decided to use yaml as my configuration file technology, and am writing a c++ linux application on OpenSuse 11.3.

The problem is that even after successfully installing cmake, compilling yaml-cpp as shown on the yaml-cpp docs page, I still can’t compile the simple demo programs on the yaml-cpp page here.

For example, when I try to compile the the monster.yaml and main.cpp example

my compiler on issuing the command gcc main.cpp, it issues the following errors:

main.cpp:24:25: error: ‘YAML’ does not name a type
main.cpp:24:35: error: expected unqualified-id before ‘&’ token
main.cpp:24:35: error: expected ‘)’ before ‘&’ token
main.cpp:24:35: error: expected initializer before ‘&’ token
main.cpp:30:25: error: ‘YAML’ does not name a type
main.cpp:30:35: error: expected unqualified-id before ‘&’ token
main.cpp:30:35: error: expected ‘)’ before ‘&’ token
main.cpp:30:35: error: expected initializer before ‘&’ token
main.cpp:35:25: error: ‘YAML’ does not name a type
main.cpp:35:35: error: expected unqualified-id before ‘&’ token
main.cpp:35:35: error: expected ‘)’ before ‘&’ token
main.cpp:35:35: error: expected initializer before ‘&’ token

I tried changing the include directive from #include "yaml-cpp/yaml.h" to #include <yaml.h>, since I’d installed the yaml lib, but this didn’t solve anything.

so what did I do wrong?

Here is the problematic code pasted from lines 24 to 40:

void operator >> (const YAML::Node& node, Vec3& v) {
   node[0] >> v.x;
   node[1] >> v.y;
   node[2] >> v.z;
}

void operator >> (const YAML::Node& node, Power& power) {
   node["name"] >> power.name;
   node["damage"] >> power.damage;
}

void operator >> (const YAML::Node& node, Monster& monster) {
   node["name"] >> monster.name;
   node["position"] >> monster.position;
   const YAML::Node& powers = node["powers"];
   for(unsigned i=0;i<powers.size();i++) {
      Power power;
      powers[i] >> power;
      monster.powers.push_back(power);
   }
}

And here is a dump of the output of the sudo make install after I run the make command:

[ 81%] Built target yaml-cpp
[ 96%] Built target run-tests
[100%] Built target parse
Install the project...
-- Install configuration:      "Release"                                                                                                                                              
-- Installing: /usr/local/lib/libyaml-cpp.so.0.2.6
-- Up-to-date: /usr/local/lib/libyaml-cpp.so.0.2
-- Up-to-date: /usr/local/lib/libyaml-cpp.so
-- Up-to-date: /usr/local/include/yaml-cpp/aliasmanager.h
-- Up-to-date: /usr/local/include/yaml-cpp/anchor.h
-- Up-to-date: /usr/local/include/yaml-cpp/conversion.h
-- Up-to-date: /usr/local/include/yaml-cpp/dll.h
-- Up-to-date: /usr/local/include/yaml-cpp/emitfromevents.h
-- Up-to-date: /usr/local/include/yaml-cpp/emitter.h
-- Up-to-date: /usr/local/include/yaml-cpp/emittermanip.h
-- Up-to-date: /usr/local/include/yaml-cpp/eventhandler.h
-- Up-to-date: /usr/local/include/yaml-cpp/exceptions.h
-- Up-to-date: /usr/local/include/yaml-cpp/iterator.h
-- Up-to-date: /usr/local/include/yaml-cpp/ltnode.h
-- Up-to-date: /usr/local/include/yaml-cpp/mark.h
-- Up-to-date: /usr/local/include/yaml-cpp/node.h
-- Up-to-date: /usr/local/include/yaml-cpp/nodeimpl.h
-- Up-to-date: /usr/local/include/yaml-cpp/nodereadimpl.h
-- Up-to-date: /usr/local/include/yaml-cpp/nodeutil.h
-- Up-to-date: /usr/local/include/yaml-cpp/noncopyable.h
-- Up-to-date: /usr/local/include/yaml-cpp/null.h
-- Up-to-date: /usr/local/include/yaml-cpp/ostream.h
-- Up-to-date: /usr/local/include/yaml-cpp/parser.h
-- Up-to-date: /usr/local/include/yaml-cpp/stlemitter.h
-- Up-to-date: /usr/local/include/yaml-cpp/stlnode.h
-- Up-to-date: /usr/local/include/yaml-cpp/traits.h
-- Up-to-date: /usr/local/include/yaml-cpp/yaml.h
-- Up-to-date: /usr/local/include/yaml-cpp/anchordict.h
-- Up-to-date: /usr/local/include/yaml-cpp/graphbuilder.h
-- Installing: /usr/local/lib/pkgconfig/yaml-cpp.pc

Could there probably be some special directive / option that I have to append to the gcc command when compiling with libyaml? something like gcc main.cpp -libyaml ?

For more output from the compiler (gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)) :

/tmp/ccYltArL.o: In function `operator>>(YAML::Node const&, Monster&)':
main.cpp:(.text+0x1a8): undefined reference to `YAML::Node::size() const'
/tmp/ccYltArL.o: In function `main':
main.cpp:(.text+0x1fe): undefined reference to `std::basic_ifstream<char,      std::char_traits<char> >::basic_ifstream(char const*, std::_Ios_Openmode)'
main.cpp:(.text+0x215): undefined reference to   `YAML::Parser::Parser(std::basic_istream<char, std::char_traits<char> >&)'
main.cpp:(.text+0x224): undefined reference to `YAML::Node::Node()'
main.cpp:(.text+0x23e): undefined reference to    `YAML::Parser::GetNextDocument(YAML::Node&)'
main.cpp:(.text+0x29c): undefined reference to `std::cout'

and much more stuff than can fit here
, finally ending in:

/tmp/ccYltArL.o:(.rodata._ZTIN4YAML14BadDereferenceE[typeinfo for YAML::BadDereference]+0x0): undefined reference to `vtable for    __cxxabiv1::__si_class_type_info'
/tmp/ccYltArL.o:(.rodata._ZTIN4YAML11KeyNotFoundE[typeinfo for YAML::KeyNotFound]+0x0): undefined reference to `vtable for  __cxxabiv1::__si_class_type_info'
/tmp/ccYltArL.o:(.rodata._ZTIN4YAML13InvalidScalarE[typeinfo for YAML::InvalidScalar]+0x0): more undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow
/tmp/ccYltArL.o:(.rodata._ZTIN4YAML9ExceptionE[typeinfo for YAML::Exception]+0x8): undefined reference to `typeinfo for std::runtime_error'
/tmp/ccYltArL.o:(.eh_frame+0x18f): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

— finally —

Solved it with Chris’s soln (see below), though I actually found an even cleaner way of pre-loading ‘custom’ libraries, by using the ldconfig command to configure the library search path after i add the path to my libs into a *.conf file in /etc/ld.so.conf.d/. See the detailed guide here…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:30:17+00:00Added an answer on May 21, 2026 at 2:30 pm

    gcc isn’t being instructed to look in /usr/local. You need to do it explicitly. Also, that really should be g++ and not gcc. So first make sure your include looks like this:

    #include "yaml-cpp/yaml.h"
    

    Then compile it like this:

    g++ -I/usr/local/include -L/usr/local/lib -lyaml-cpp -o testprogram main.cpp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a socket application that I use to send string back and
I have just recently started out programming for Android, and have decided that I
I have a simple SQLite database I use to track invoices. I recently decided
My team recently decided not to use the trunk branch that is typical of
Apple recently decided to allow developers to use this UIGetScreenImage private API. I have
recently i've decided to use viewmodels instead of EF EntityObjects. i'm sure that there
We have recently decided to use Maven as build system. I'm responsible to migrate
I have been studying python for quite sometime now and very recently I decided
I have recently had a linux server compromised from bots uploading .php scripts and
I have recently been working on implementing an ajax based file uploader for my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.