Home Download Buy Blog Forum Support

Running a C++ Program with libraries via Build System

Running a C++ Program with libraries via Build System

Postby meriticus on Mon Mar 18, 2013 9:42 pm

The (C++) program I want to compile relies on some boost libraries. I've managed to create a build system that can build
the program successfully, but the run variant does not work. Specifically, I believe it has issues locating the library / passing on the
library arguments to the compiler.

Code: Select all
   "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "-I/usr/local/include", "-L/usr/local/lib", "-lboost_system"],
   "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
   "working_dir": "${file_path}",
   "selector": "source.c, source.c++",

         "name": "Run",
         "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}' -L/usr/local/lib -L/usr/local/lib -lboost_system"]

Code: Select all
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ccT6YF4S.o
      boost::asio::error::get_system_category()    in ccT6YF4S.o
  "boost::system::generic_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ccT6YF4S.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
[Finished in 1.2s with exit code 1]

I've tried multiple combinations for the arguments, splitting them up into an array, quotes, no quotes, etc. Yet it still seems to fail to pass the arguments to g++ successfully. Is there a way to pass the arguments to g++ (or anything else to fix the problem), or is this not feasible for a run build.

Posts: 1
Joined: Mon Mar 18, 2013 9:36 pm

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 30 guests