Installing linux library in C - c

I am a beginner with linux and C and wanted to learn how to successfully install external libraries.
Therefore, I have a recent project to aid my understanding of my MacOS usb ports, I am taking steps into: The Linux-USB Host Side API. This mentions the package is the the following:
<linux/usb/ch9.h>
I found this on the linux github: linux-usb.
How do I successfully install this onto my MacOS to use within Visual Studio Code?

Related

How to add the missing os libraries to TI compiler

I am using Code Composer Studio to build application for the target EK-TM4C1294XL TI board.
The TI boards come with their own compiler and the compiler is missing os libraries like wsock.lib and ws2_32.lib which are socket libraries used for connecting to internet. I am trying to build a open62541 application which require the mentioned libraries. I could build the applications in visual studio without any errors by linking wsock.lib and ws2_32.lib. How to proceed in this case? Is anyone able to build an open62541 application using TI compiler?

How to compile and run C on a Surface Pro X?

I'd like to program some Ansi-C on a Surface Pro X. On my Computer I just set up VS Code as an editor and installed Msys2 which comes with the GCC. But the same won't work on the Surface Pro X, cause if the processor architecture as I understand (correct me if I'm wrong).
So my question is: How can I compile and run C on a Surface Pro X and also check for Ansi C conformity. It also would be nice to be able to work in VS Code.
Also is this a general problem of the Surface Pro X? Would those issues also appear when trying to program java or python?
I don't have a Surface Pro X or any other ARM Windows device, however it should be possible to use VS Code since there has been a Windows on ARM version since May 2020 (download on the usual Visual Studio Code download page).
I am not sure on what development environments are available for Windows on ARM, but you could always install WSL (the Windows subsystem for Linux) where you can then install pretty much anything you want. You can then link your VS Code to your WSL and work there.
To install development tools for any language you would then follow instructions on how to install that environment for Linux (eg. using apt-get for Debian and it's derivatives like Ubuntu).
To install basic development tools for Java and C/C++ in WSL type sudo apt install default-jdk default-jre gcc g++, python is generally already installed in a linux environment.

Build C executable for Raspberry Pi on Windows or Linux

I have to design a C executable (no GUI) that is supposed to run on Raspberry PI. I'm familiar with design using IDE like Visual Studio or Eclipse (with CDT plugin). If i use Raspberry PI as a design machine, I think I have no chance to use a standard IDE. I should use makefiles and gcc compiler only.
Is there any chance to develop Raspberry PI executable using Visual Studio (for Windows) or Eclipse (for both Windows and Linux).
You can specify to eclipse projects with Makefiles. You can also specify a compilation toolchain.
So yes, you can develop and compile for Raspberry Pi or for other plateforms using Eclipse.
For getting toolchain and other tools for Rasp Pi you can find things here.
In Eclipse, you create a new or import a project choosing Makefile Project with Existing Code then add your toolchain.
If you have a newer Pi like the 4, you should be able to run eclipse directly from the Pi desktop. You can download via:
sudo apt-get install eclipse
This will be a stripped-down version and will likely run quite slow, so I agree compiling on a more powerful remote machine is better...
Is there any chance to develop Raspberry PI executable using Visual Studio (for Windows) or Eclipse (for both Windows and Linux).
Yes, this is called cross-compiling. You can set up a cross-compile toolchain for the raspberry pi on windows or linux and configure your Eclipse CDT project to build with the toolchain. You can even set up remote debugging.
This website has good information and a step-by-step guide for windows using cygwin.
This looks like a good guide for linux.
Edit:
Just realized you asked for Visual Studio on Windows. I don't think there is Visual Studio support for this. The example I pointed to sets up cygwin so you have an emulated linux environment. You could also set up a VM using free VM software and install a linux environment that way, and run eclipse CDT from there. This is what I did when setting up a cross compiling environment for the Raspi.

Switch C project configuration in Eclipse between Windows and Linux

I installed Eclipse with CDT plugin. I created a simple TCP client software that runs on Windows. I can open the project on Ubuntu also. I'd like to change build configuration in order to create Linux executable. Is it possible to create executable for the operating system that the project is compiled. I mean if I compile the project on Ubuntu, there should be Linux executable and if I compile the project on Windows, there should be Windows executable. Is it possible?
It is possible. When you are creating a Project in Eclipse, you are provided with two build options. One debug and one release. The release build will create the executable for the OS in which it is run.
Good Luck!

What does Eclipse CDT come with?

This is what i currently have installed on my home computer:
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers-includes-incubating-components/indigosr2
Now, that was a pain to setup because you needed to use Cygwin to install a bunch of stuff in order for Eclipse to compile and run a C project. I found this the other day:
http://www.eclipse.org/cdt/
Does Eclipse CDT come with everything it needs to compile and run a C program or does it still depend on external files? Does it come with a standard library?
You do not have to use Cygwin and you can use alternatives such as mingw (it is simpler for most people to install). Checkout this tutorial for detailed description how to setup on Windows:
http://www.banym.de/eclipse/install-eclipse-cdt-on-windows-7
Compiler is responsible for standard library and in the case mentioned above it is mingw.
If you are on other hand interested about MAC OS installation checkout:
http://forge.mysql.com/wiki/Eclipse/CDT_on_Linux_and_Mac_OS_X
http://max.berger.name/howto/cdt/cdt.jsp

Resources