Showing posts with label C and Cpp. Show all posts
Showing posts with label C and Cpp. Show all posts

Saturday, October 17, 2015

Remote develop C/C++ program from Windows 10, run on Raspberry Pi, using NetBeans IDE

This post show how to develop C/C++ program on Netbeans IDE run on Windows 10, set up remote host on raspberry Pi. Such that you can run the program on Raspberry Pi remotely.




Local client host (the PC you used to develop):
Windows 10
Netbeans IDE 8.0.2 with C/C++ plugins (https://netbeans.org/community/releases/80/cpp-setup-instructions.html#downloading)
C/C++ compiler: 32-bit MinGW(https://netbeans.org/community/releases/80/cpp-setup-instructions.html#mingw)

Remote host (The target remote platform to run the program):
Raspberry Pi 2
Raspbian Jessie (2015-09-24)

Follow the steps in the video:



Test code, C++:
#include <iostream>

using namespace std;

int main(int argc, char** argv) {

    std::cout << "Hello World!\n";
    
#ifdef __linux__
    std::cout << "__linux__\n";
#elif defined(__unix__)
    std::cout << "__unix__\n";
#elif defined(_WIN64)
    std::cout << "Windows 64\n";
#elif defined(_WIN32)
    std::cout << "Windows 32\n";
#endif

#if __WORDSIZE == 64
    std::cout << "64 bit\n";
#else
    std::cout << "32 bit\n";
#endif

    return 0;
}

Reference:
https://netbeans.org/kb/docs/cnd/remote-modes.html
https://netbeans.org/kb/docs/cnd/remotedev-tutorial.html#setup

Related:
Remote run JavaFX on Raspbian Jessie, from Netbeans/Windows 10


Sunday, March 22, 2015

Install C/C++ plugins for NetBeans on Raspberry Pi 2/Raspbian

It is assumed you have NetBeans 8.0.2 installed on your Raspberry Pi 2/Raspbian. By installing C/C++ plugins to NetBeans IDE, you can develop in C/C++.


- Click Tools -> Plugins
- Select Available Plugins tab
- Search C/C++, and check it.
- Click Install


Wednesday, March 19, 2014

Build GTK+ Project using Code::Blocks on Raspberry Pi

In the Project Wizard of Code::Blocks, GTK+ Project is supported. But it cannot be compiled, because of lack of options for GTK+.

Prepare:

Create GTK+ Project with File > New > Project...
Select GTK+ project, with the auto-generated source code.

Set Build Options:
Project > Build options...
- In Compiler settings > Other options, add `pkg-config --cflags gtk+-3.0`.

Compiler settings > Other options
- In Linker settings > Other linker options, add `pkg-config --libs gtk+-3.0`.

Linker settings > Other linker options
Build and Run:
helloGtk

Install Code::Blocks on Raspberry Pi

Code::Blocks is a open source, cross platform, free C, C++ and Fortran IDE.

To install Code::Blocks on Raspberry Pi, enter the command:
sudo apt-get install codeblocks

Current installed version is 10.05.
Code::Blocks
Code::Blocks installed on Raspberry Pi
Once installed, Code::Blocks can be start by enter the command:
codeblocks

Or click Start in X-Window > Programming > Code::Blocks IDE