Tag Archives: How To

Compiling a C Program from Visual C++ 2015 Command Prompt

For quick compiling of C/C++ programs on a Windows PC,  the Visual C++ 2015 Command Prompt is your go to program. Many programs have no need for development in an IDE.

Before you can compile a c/c++ program you will need to install the Microsoft Visual C++ Build Tools 2015.

Once installed you will have a new list of shortcuts in your Start Menu.

Visual C++ Build Tools Start Menu Shortcuts
Visual C++ Build Tools Start Menu Shortcuts

If you right click on any one of the Visual C++ 2015 Programs and choose Open File Location you will also see the extensive list of tools.

Visual C++ Build Tools Explorer Shortcuts
Visual C++ Build Tools Explorer Shortcuts

Depending on what system architecture you are running, open one of the programs. If in doubt select:
Visual C++ 2015 x86 Native Build Tools  Command Prompt
or
Visual C++ 2015 x64  x86 cross Build Tools  Command Prompt

The following window will appear:

Visual C++ 2015 Build Tools Command Prompt
Visual C++ 2015 Build Tools Command Prompt

To verify that the prompt is functioning property, type cl and the prompt will output the exact same information again.
Note: You can use the Visual C++ 2015 Build Tools Command Prompt the same way you would use the standard command prompt for directory navigation.

  1. To test a simple C program, first create a test directory to hold your test program. md c:\test to create a directory, and then enter cd c:\test to change to that directory. This is where your source files and executable will be stored.
  2. Type notepad test.c  When the  Notepad alert dialog  pops up, choose Yes to create the new test.c file in your current working directory.
  3. In Notepad, enter the following code and save as test.c:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
getchar(); //used to prevent executable from closing when double clicked
return ;
}
  1. Now from the Visual C++ Build Tools Command Prompt type: cl test.c. If the program compiled successfully you will see: /out:test.exe and test.obj. In your test folder you will now have the test.c source file along with test.obj and test.exe
  2. To run your newly compiled program simply type test and your program will run in the command prompt. You can also double click the test.exe executable.

To compile a program with more than one source file simply type:

cl test.c test2.c test3.c

The compiler will output a single file called file test.c
To change the name of the output program, add an /out linker option:

cl test.c test2.c test3.c /link /out:mynewprogram.exe

test.c source file

WordPress Appearance Editor Disappeared – Fix

Many people have had issues with their appearance editor disappearing. If this has happened to you, please follow these steps:

  1.  Fire up your favorite ftp client and connect to your WordPress site.
  2.  Navigate to wp-config.php which will be in your web site root www folder by default.
  3.  Search for the following line of code:
            define(‘DISALLOW_FILE_EDIT’, true);
    and change it to:
            define(‘DISALLOW_FILE_EDIT’, false);
  4.  Save and re upload the wp-config.php file.
  5.  Now Editor should be back in your Appearance menu. If not refresh the page.

Arduino: How To Make An LED Blink

In this tutorial we will make an LED (light emitting diode) blink at specific intervals.

Items you will need:

  • 1 Arduino (UNO or equivalent)
  • 1 USB cable
  • 1 Breadboard
  • 3 connection wires (preferably male-male breadboard jumper wires and in 3 different colors. In this tutorial we will use Black for Ground, Red for 5v and Yellow for Arduino output).
  • 1 LED (light emitting diode) – 5 mm; leg yes; color Red (633nm)
  • 1 330 Ω Resistor – tolerance ±5%; resistance 330Ω

Component notes:

  • Arduino – please refer to “What Is An Arduino?” http://www.sysrecon.com/?p=15
  • LED (light emitting diode) – Make sure the short leg, marked with a flat side goes into the negative position (-)
  • 330 Ω Resistor – The color bands should read Orange, Orange, Brown, Gold. The direction of the resistor when placed on the breadboard is irrelevant.

To determine which resistor to use, please check the chart below:

Resistor Color Chart

 

4 Band Resistor Calculator

 Some resistors have the color bands grouped together  close to one end. Hold the resistor with the closely grouped bands to your left and read the resistor from the left to the right. Also, the first band can’t be silver or gold.

 

The schematic of the circuit we will be creating is as follows:

Arduino Blink Basic Schematic

Arduino LED Blink Detailed Schematic

Our finished circuit will look as follows:

Arduino Blink Breadboard

  • LED GOES FROM D10(+ anode) TO D11(- cathode)
  • 333O Resistor GOES FROM B11 TO Anywhere on breadboard ground (- GND)
  • Black Jumper Wire GOES FROM Arduino GND TO Breadboard Ground(-)
  • Red Jumper Wire GOES FROM Arduino 5V TO Breadboard Power (+)
  • Yellow Jumper Wire GOES FROM Arduino PIN13 TO Breadboard E10

Now that the circuit is built, we can connect the Arduino to our computer. Once it is connected open up the Arduino Integrated Development Environment (IDE). Before we start adding the code, click on Tools → Board and select the correct Arduino board you are using. Next, click on Tools → Serial Port and select your correct port. Once the IDE is setup enter the code below either by typing, copy and paste or by downloading from http://www.sysrecon.com/downloads/arduino/blink.ino

 

/*
Blink
Turns on an LED on for five seconds, then off for five seconds, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5000); // wait for 5 seconds
digitalWrite(led, LOW); // turn the LED off by making voltage LOW
delay(5000); // wait for 5 seconds
}

Once you have entered the code into the IDE, click verify to ensure the code compiles and then click upload to get the sketch onto your Arduino.

Arduino IDE Verify and Upload

After a few seconds the Arduino will restart and you will see the sketch begin to execute.

You should also notice that the Arduino has an LED on-board that will sync to your LED on the breadboard. If you do not have the components to create this circuit, you can still test the source code with the Arduino’s on-board LED.

We hope you enjoyed this Arduino tutorial. Keep checking back as there will be many more to come!

How to install unsigned drivers in Windows 8.1

Microsoft did not implement Driver Signature Enforcement to annoy you. They did is to protect you from installing malicious software. This makes it a little more difficult for Rootkits to be installed on your PC. Be sure you know what you are installing!

The following steps will only last until you reboot your PC.

  1. Open Settings by clicking on your Start Screen or hitting the Windows key on your keyboard. Hover your mouse at the bottom right of the start screen until the sidebar appears. Click Settings.
  2. On the settings screen, click on Update and Recovery.
  3. On the Update and Recovery screen click Recovery.
  4. Click Restart Now under Advanced Startup.
    (Your PC will Restart into Advanced Boot Mode for this session only)
  5. Choose Troubleshoot from the Advanced Boot menu.
  6. Choose Advanced Options from the Troubleshoot menu.
  7. Choose Startup Settings from the Advanced Options Menu.
  8. Click Restart on the Startup Settings page.
    (Your PC will Restart with Advanced Startup Settings)
  9. From the Startup Settings menu choose: 7) Disable Driver Signature Enforcement.
    (Your PC will now fully boot up and Driver Signature Enforcement will be disabled for this session. Once you reboot or power down your PC Driver Signature Enforcement will be enabled.)
  10. Install your unsigned driver software. You will still get the Windows Security Alert (just click Install this driver software anyway)

Enjoy your software!