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

  • Home
  • SEARCH
  • 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 3791528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:29:01+00:00 2026-05-19T12:29:01+00:00

Hi basicly i am trying to use the svm from here . It is

  • 0

Hi basicly i am trying to use the svm from here . It is written in C and gives instructions how to use it in c++:

  • Compile “svm_learn.c”, “svm_common.c”, and “svm_hideo.c” as
    C code.
  • The C++ program you want to call svm_learn/8 and classify_example/2
    (or classify_example_linear/2) from
    needs to include the following
    headers:

    extern “C” {
    # include “svm_common.h”
    # include “svm_learn.h”
    }

  • Link “svm_learn.o”, “svm_common.o”, and “svm_hideo.o” to your program.

So i compiled the mentioned files and got the needed .o files.
Than i added:

SET( svm_lib_light_obj
    E:\framework\svm_light\build\svm_learn.o
    E:\framework\svm_light\build\svm_common.o
    E:\framework\svm_light\build\svm_hideo.o
)

ADD_LIBRARY(
    svm_lib_light
    STATIC
    EXCLUDE_FROM_ALL
    ${svm_lib_light_obj}
)

SET_SOURCE_FILES_PROPERTIES(
  ${svm_lib_light_obj}
  PROPERTIES
  EXTERNAL_OBJECT true # to say that "this is actually an object file, so it should not be compiled, only linked"
  GENERATED true       # to say that "it is OK that the obj-files do not exist before build time"
  )

SET_TARGET_PROPERTIES(
  svm_lib_light
  PROPERTIES
  LINKER_LANGUAGE C # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
  ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib
  )

So now i just need to include the .h files mentioned. I added them to my other source files in:

ADD_EXECUTABLE ( MYProgramm
            ...
            #other source files
            ...
            src/svm_common.h
            src/svm_learn.h
)

Unfortunatly it doesnt work. Calling any function from these .h files leads to an linker error LNK2001, LNK1120.
I am guessing i have to tell cmake that these .h files are frontends for the .o files. But how?

  • 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-19T12:29:02+00:00Added an answer on May 19, 2026 at 12:29 pm

    The best way would be to add those C files to your project:

    SET(SVM_LIGHT_SRC_DIR "E:/framework/svm_light")
    
    INCLUDE_DIRECTORIES(${SVM_LIGHT_SRC_DIR})
    
    ADD_LIBRARY(
        svm_lib_light
        ${SVM_LIGHT_SRC_DIR}/svm_learn.c
        ${SVM_LIGHT_SRC_DIR}/svm_common.c
        ${SVM_LIGHT_SRC_DIR}/svm_hideo.c
    )
    
    ADD_EXECUTABLE ( MYProgramm
                ...
                #other source files
                ...
    )
    
    TARGET_LINK_LIBRARIES(MYProgram svm_lib_light)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the value of an asp:HiddenField control in javascript after postback
I'm trying to use pulseaudio to play the contest of a vorbis-stream but are
What I'm trying to do is basicly what this photo shows. When I select
Hi I'm having trouble trying to generalize a function I've written for an specific
I'm trying to redirect to a page but based on the answer from a
I'm looking for a free winforms component for an application I'm writing. I basicly
I am trying to integrate facebook connect with nmy social network site, currently users
Im trying to work out the best way scale my site, and i have
I'm trying to figure out the best practice to setup hierarchy data that i
I have a session class that basicly just sets and retrieves session variables, the

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.