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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:28:29+00:00 2026-06-15T17:28:29+00:00

I have a problem importing the vector class to cython using from libcpp.vector cimport

  • 0

I have a problem importing the vector class to cython using

from libcpp.vector cimport vector

when I add this and try to compile the pyx file I get

python setup.py build_ext --inplace
running build_ext
skipping 'kmc_cy.c' Cython extension (up-to-date)
building 'kmc_cy' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/python2.7 -c kmc_cy.c -o build/temp.linux-x86_64-2.7/kmc_cy.o
kmc_cy.c:254:18: fatal error: vector: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Here is my setup.py

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import sys
sys.path.append("/usr/lib64/python2.7/site-packages/Cython/Includes/libcpp")

ext_modules = [Extension("kmc_cy", ["kmc_cy.pyx"])]

setup(
  name = 'kmc_cy',
  cmdclass = {'build_ext': build_ext},
  ext_modules = ext_modules,
)

Cheers

  • 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-15T17:28:30+00:00Added an answer on June 15, 2026 at 5:28 pm

    As std::vector is C++ code, you need to set the correct language:

      ext_modules = [Extension("kmc_cy", ["kmc_cy.pyx"],language='c++')]
    

    Then g++ should be used instead of gcc and the file name should end with .cpp or .cc.
    See this answer for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem, during importing data from cube using PowerPivot for Excel. When
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with importing jar file and running in Geany IDE . This
I have a perl problem: importing symbols, depending on the path elements in @INC
I have problem with UIWebView delay when the load image from url. In my
I have a class that looks like this: typedef std::list<char*> PtrList; class Foo {
I am using the Codeblock IDE with MingW, I have an ongoing problem with
Possible Duplicate: error of importing DBI in Perl I have a problem when I
I have a problem importing a table to oracle. When I import it a
I have a problem importing a CSV file with RapidMiner. Floating point values are

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.