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 8689723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:43:39+00:00 2026-06-12T23:43:39+00:00

I read through nearly every library linking tutorial but none worked for my specific

  • 0

I read through nearly every library linking tutorial but none worked for my specific problem.

I have a folder called VSCOM_API_TEST with these files and folders in it:


VSCOM_API_TEST/CMakeLists.txt
VSCOM_API_TEST/include/vs_can_api.h
VSCOM_API_TEST/include/startup.h
VSCOM_API_TEST/lib/libvs_can_api.so
VSCOM_API_TEST/lib/libvs_can_api.a
VSCOM_API_TEST/src/startup.cpp

startup is my executable where I want to include the library.

And I have the problem that my programme can’t find the library functions:

CMakeFiles/startup.dir/src/startup.o: In function main:
/home/max/fuerte_workspace/sandbox/VSCOM_API_TEST/src/startup.cpp:6: undefined reference to VSCAN_Open

CMakeLists.txt

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)


rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#common commands for building c++ executables and libraries
rosbuild_add_library(${PROJECT_NAME} lib/libvs_can_api.a)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
rosbuild_add_executable(startup src/startup.cpp)
#target_link_libraries(startup ${PROJECT_NAME}) 

startup.cpp

// ROS includes
#include <ros/ros.h>
#include <vs_can_api.h>
int main(int argc, char** argv)
{
VSCAN_HANDLE handle = VSCAN_Open("192.168.5.10:23", VSCAN_MODE_NORMAL);

VSCAN_API_VERSION *version;
VSCAN_STATUS status;
VSCAN_HWPARAM *hwParams;

// API Version
status = VSCAN_Ioctl(handle, VSCAN_IOCTL_GET_API_VERSION, &version);

//HW Version
status = VSCAN_Ioctl(handle, VSCAN_IOCTL_GET_HWPARAM, &hwParams);


}  

So how can I add a precompiled library?

  • 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-06-12T23:43:40+00:00Added an answer on June 12, 2026 at 11:43 pm

    I’m not familiar with rosbuild at all, but the following points might help:

    • It’s unusual to change the output paths for built exes and libs to be part of the source tree. You probably want to delete the set(EXECUTABLE/LIBRARY_ ...) lines.
    • rosbuild_add_library is a wrapper round CMake’s add_library command and is not intended to be used in conjunction with a compiled library. Instead it would be used to define the sources needed to create a library. This line should be deleted too.
    • Setting the LINKER_LANGUAGE to C is probably unnecessary, and should probably be CXX anyway.
    • target_link_libraries is the command you want to use to link to the compiled library. However, you’ll need to provide the full path to the library as the second argument.

    So (without having tested it) I’d suggest you try the following CMakelists.txt

    cmake_minimum_required(VERSION 2.4.6)
    include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
    rosbuild_init()
    rosbuild_add_executable(startup src/startup.cpp)
    target_link_libraries(startup ${CMAKE_CURRENT_LIST_DIR}/lib/libvs_can_api.a)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read through the forum for clues how to solve my problem, but none
I read through many of solutions of this problem already, but I still can't
I read through quite a few similar questions here on SO but none were
I have read through several articles which are alternatives to using setpixel/getpixel but I
I read through all existing posts on the same topic, but I still have
I have read through the solutions to similar problems, but they all seem to
Note: I have read through the last 150 svn commit error questions and none
I've read through all of the Spring 3 Web docs: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-web.html but have been
I read through Apple's EADemo project. I then attempted my own. But when I
Had a good read through similar topics but I can't quite a) find one

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.