Language - C macOS GCC: Difference between revisions

From Phidgets Support
No edit summary
(Redirected page to Language - C)
 
Line 1: Line 1:
[[Category:Language]]{{NoTitle}}
#REDIRECT [[Language - C]]
{|
|style="vertical-align:middle; width: 60%;"|
<font size=6>'''Language - C'''
 
'''macOS with GCC'''</font>
 
Welcome to using Phidgets with C! By using C, you will have access to the complete Phidget22 API, including events.
 
GCC is a compiler system originally written for GNU, and is the standard compiler on unix-like operating systems. GCC is readily available on macOS, and can be used to compile C programs from the terminal.
|{{TOC limit|2}}
|}
{{Language_-_C_Intro|macOS|GCC}}
 
{{Finding Code Samples|C}}
 
==Using the Code Samples==
To use the code sample from the [{{server}}/?view=code_samples&lang=C Code Samples] page, you can click the '''Download Example''' button to download a C file with the sample code.
 
[[Image:C_Sample_Code_Download.png|link=|center|800px]]
 
 
Once you have the example, you can compile and run your code:
 
==Compile and Run==
 
To compile C programs, you will need gcc. You likely have gcc installed on your macOS machine already, but if not, you can easily get it by downloading [https://developer.apple.com/xcode/ Xcode].
 
To compile the program, enter the following command in the terminal, substituting "example" for the name of your C file:
<syntaxhighlight lang='bash'>
gcc example.c -o example -F /Library/Frameworks -framework Phidget22 -I /Library/Frameworks/Phidget22.framework/Headers
</syntaxhighlight>
 
Finally, run the program by entering the following command in the terminal:
<syntaxhighlight lang='bash'>
./example
</syntaxhighlight>
 
Success! The project is now running with Phidgets.
 
{{Language Page What's Next}}

Latest revision as of 16:36, 15 March 2021

Redirect to: