Skip to content
Advertisement

Tag: c++

How can I set up launch.json in Visual Code to debbug C

I’m newbie about Visual Code. I’d like to use Debbuging function with Visual Code. But There is a probelm to do it. It may happen by wrong launch.json setting(In my opnion) I’m using mac os newest version. I refered to some pages to do it myself. https://code.visualstudio.com/docs/languages/cpp https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md https://code.visualstudio.com/docs/python/debugging However I saw same error. It said “launch: program ‘${/Users/bpk/Documents/Study/C/Study}/study’ does

How to make c++ return 2d array to python

I find an example showing how to return a 1D array from c++ to python. Now I hope to return a 2D array from c++ to python. I imitate the code shown in the example and my code is as follows: The file a.cpp: The file b.py: I run the following commands: Then I get the following prints: It seems

How to use compile_commands.json with clang python bindings?

I have the following script that attempts to print out all the AST nodes in a given C++ file. This works fine when using it on a simple file with trivial includes (header file in the same directory, etc). However, I get a clang.cindex.TranslationUnitLoadError: Error parsing translation unit. when I run the script and provide a valid C++ file that

How to pass Python list to C function using Cython

I am using a Raspberry Pi to interface with custom hardware connected to the GPIO. The controlling software is written in Python, and the interface to the custom hardware is written in C, as it is a much faster C implementation. I now need to start calling my C functions from my Python, and have recently been learning how to

How to disable selection highlighting in a QTableWidget

I have a QTableWidget with a disabled setSelectionMode (QTableWidget::NoSelection) and the QTableWidgetItems I fill in don’t have the Qt::ItemIsEditable flag. Nevertheless, a cell that has been clicked gets some kind of cursor (the black line at the bottom in my case): How can I disable this “cursor”? Answer Does this help? To elaborate a bit: the appearance of the items

Pass a 2d numpy array to c using ctypes

What is the correct way to pass a numpy 2d – array to a c function using ctypes ? My current approach so far (leads to a segfault): C code : Python code: Answer This is probably a late answer, but I finally got it working. All credit goes to Sturla Molden at this link. The key is, note that

Getting started with cython on mac os

I wrote a simple program in python: Then I execute this: It was generated a file: main.c And then I tried this: And I have an error: How to compile python to c ? How to get started with cython with xcode on mac ? Answer You have to tell the gcc compiler where is the pyconfig.h file on your

Python vs C: different outputs

I have a small program that converts a base 10 number into a kind of a base 36 number. Here’s the Python code, and it works as expected. The output is “4 45 46” correctly represents 0, and “4 9 24” correctly represents 200. But the issue is, it stops working after I convert it to C code. Now the

C++ to simpler language (Python, Lua, etc) converter? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 7 years ago. Improve this question I know Python and I’ve come across a small C++ source

Advertisement