Archivi categoria: Tutorial
Online syntax highlighting – tohtml.com
Ciao a tutti,
volevo solo segnalarvi un fantastico tool online che bramavo da tempo per il mio blog.
Questo tool permette di ottenere in output, dato in ingresso un codice di un qualsiasi* linguaggio di programmazione, il corrispettivo codice con le evidenziazioni della sintassi in HTML.
Quindi se io ad esempio voglio scrivere un codice nel mio articolo di WordPress e il semplice tag <pre> non permette una buona interpretazione del codice oppure non ho voglia di installare un plugin apposta per l’highlighting:
- vado su http://tohtml.com
- incollo il codice nella textbox Source Code
- scelgo il linguaggio di programmazione del codice incollato
- eventualmente anche lo stile di evidenziazione
- premo Hightlight
#include <stdio.h>
int main()
{
printf("hello, world");
return 0;
}
e lo do in pasto a questo tool, otterrò
#include <stdio.h> int main() { printf("hello, world"); return 0; }
Ovviamente se si vuole aggiungere questo codice evidenziato a un articolo di WordPress, sarà necessario incollare l’output del tool nell’editor HTML dell’articolo e non in quello Visuale.
Per ora è tutto: passo e chiudo!
Cheers! 😉
*ho usato qualsiasi perché sono veramente tanti se andate a vedere nella lista dei linguaggi di programmazione compatibili, si trova veramente di tutto 🙂
VLC Remote Control unit – Arduino
Questo articolo lo potrete trovare a questo indirizzo.
http://allafinedelpalo.it/vlc-remote-control-unit-arduino/
Scusate per il disagio.
HOW TO installare le wxWidgets per C/C++ su Ubuntu e compilare da Eclipse
Un anno e mezzo fa circa provai a installare le Wxwidgets su Ubuntu con risultati piuttosto catastrofici! Non so perché onestamente…forse perché ero appena stato acquisito dalla famiglia Linux e non avevo idea di come ci si muovesse per installare una libreria. Via, parliamoci chiaro: ero un n00b! Non che adesso sia un mago ma almeno mi so difendere 🙂
Bando alle ciance! Cominciamo!
La procedura è molto semplice, qui di seguito la divido in due parti:
- come installare la libreria
- come compilare non da terminale ma direttamente da Eclipse
Parte 1
- Andare sul gestore pacchetti e installare questi due pacchetti e le rispettive dipendenze
- libwxgtk2.8-dev
- libwxgtk2.8-dbg
Se non trovate questi pacchetti perché magari sono versioni vecchie rimando alla fonte
- Ovviamente serve un compilatore quindi chi non ce l’ha da terminale scriva
sudo apt-get install build-essential
- Per verificare che tutto è andato a buon fine scrivere da terminale
cd /usr/include ls | grep wxDovreste vedere una cartella chiamata wx-2.8
- Normalmente quando si includono le wxWidgets si scrive “wx/wx.h” ma nella subdirectory si ha wx-2.8/wx quindi, per evitare di dover ricordarsi ogni volta di scrivere l’include con il numero della versione, si crea un link a wx-2.8/wx scrivendo da terminale
sudo ln -sv wx-2.8/wx wx
- Quando dovete compilare i vostri file bisogna includere le wxWidgets aggiungendo alla fine del comando gcc
`wx-config --cxxflags` `wx-config --libs`
fonte: http://wiki.wxwidgets.org/Installing_and_configuring_under_Ubuntu
_______________________________________________________
Parte 2
Vi copio paro paro lo stralcio che ci interessa =)
Nota alla fine dello quote!
Eclipse CDT <3.0.0
Now it’s time to create a project with wxWidgets in mind. Create a new, managed C++ project in the folder of your choice. Add a new file to the project (one of the wxWidgets samples is a good choice), and go to project properties. Select C/C++ Build and, on the right, GCC C++ Compiler, a field called “All options” will appear. Open a console, type the command “wx-config –cxxflags”, copy the output and append it to this field. Do the same for the command “wx-config –libs” and the field “All options” that appear when “GCC C++ linker” is selected. As far as I know, the command wx-config is only available on Linux wxWidgets installations, so if you use Windows you’ll have to guess the right options. The easiest way is to look inside a working makefile and use the options that appear there.
Eclipse CDT >3.0.0 and <4.0.0
The “All Options” Textfield is no longer editable in Eclipse CDT 3.0.0 instead you have to follow these instructions:
- Create a new, managed C++ project.
- Add a new file to the project (i.e. “main.cpp” ), and go to project properties.
- Select “C/C++ Build” and then “Settings”.
- Select “GCC C++ Compiler” and the underlying “Miscellaneous” tab. Append “`wx-config –cxxflags`” to the “Other flags” edit field. Don’t forget the `backquotes`!
- Select “GCC C++ Linker” and again the underlying “Miscellaneous” tab. Append “`wx-config –libs`” to the “Linker flags” edit field. Don’t forget the `backquotes`!
- Optional: Select “GCC C Compiler” and the underlying “Miscellaneous” tab. Append “`wx-config –cflags`” to the “Other flags” edit field. You are not likely to need this
You may have to add /usr/local/lib to your LD_LIBRARY_PATH in the C/C++ Build->Environment tab (but you shouldn’t since wx-config’s cxxflags do that for you)
Eclipse CDT >4.0.0
For CDT 4.0 and up “Managed Make C++ project” has been replaced with “Executable”.
- To create a new project you can go File -> New -> Project -> C++ Project -> Executable
- By default, the project will be managed. Manageability can be set with the check box, “Generate Makefiles Automatically”, under the project properties dialog -> C/C++ Build page -> Builder Settings tab.
That’s it, now you should have code completion for wxWidgets and you should be able to compile the project.
Nota: Io che rientravo nel secondo caso (Eclipse CDT >3.0.0 and <4.0.0) ho dovuto anche aggiungere su Project->Properties->C/C++ Build->Settings->GCC C++ Linker -> Libraries, il Library search path
/usr/include/wx-2.8/wx
perché sennò non me le trovava
fonte: http://wiki.wxwidgets.org/Eclipse
__________________________________________________________
Questo è quanto per fare una prova qua c’è un hello world
http://www.wxwidgets.org/docs/tutorials/hworld2.txt
e qua un minimo di documentazione sull’hello world
http://www.wxwidgets.org/docs/tutorials/hello.htm
__________________________________________________________
PS- quando provo l’hello world, il build non rileva problemi e la finestra si vede correttamente però ho un problema non trascurabile: nell’editor mi segnala un sacco di errori del tipo
Function ‘_’ could not be resolved
oppure
Type ‘wxMenu’ could not be resolved
e altri
non so come risolvere, se qualcuno che legge il tutorial sa come si risolve, mi lasci un commentino please 🙂
Cheers! 😉