Steps to reproduce:
install the arduino 1.6.5 from their site.
Mine is @ :
/home/az/bin/arduino-1.6.5-r5/
avr-g++ installed a custom (not system ) location: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/
a. Create an Arduino project using "Arduino project wizard"
b. Replace provided sketch.cpp with the code below.
c. remove libraries.cpp file from the project.
d. you should now have only one file in your project. under "Src" directory.
/*
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup()
{
Serial.begin(9600);
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop()
{
Serial.println("Hello world!");
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
Compiler setup:
a. Settings->Compiler-> GCC for AVR. Updated "Search directories"-> Compiler to have "/home/az/bin/arduino-1.6.5-r5/hardware/tools/" ; "Linker"-> /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr ; "Toolchain" -> /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr
everything else is set to default. There are no additional variables set.
Template usage:
// Yes, i first generated the project only after that git the template.
a. git the "https://github.com/obfuscated/cb_arduino_template"
b. in /home/az/.config/codeblocks :
arduino -> /home/az/bin/arduino-1.6.5-r5/
cb_arduino_template-master -> /home/az/.config/codeblocks/cb_arduino_template-master
c. The project specific changes:
Wizard's generated project file has been modified to add "avr" subdir and i removed the APP_DIR reference and hardcoded the direct path to the arduino installation (for now):
<Target title="Arduino Uno">
<Option output="bin/Release/test_3.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
<Option compiler="avr-gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-mmcu=$(MCU)" />
<Add option="-D__AVR_ATmega328P__" />
<Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
<Add directory="$(ARDUINO_DIR)/libraries" />
<Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-mmcu=$(MCU)" />
</Linker>
<ExtraCommands>
<Add after="avr-objcopy -O ihex -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex" />
<Add after="avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OU
TPUT_FILE).eep.hex" />
<Add after="avr-size $(TARGET_OUTPUT_FILE)" />
</ExtraCommands>
<Environment>
<Variable name="ARDUINO_DIR" value="/home/az/bin/arduino-1.6.5-r5" />
<Variable name="BOARD" value="Arduino Uno" />
<Variable name="BOARD_INDEX" value="1" />
<Variable name="MCU" value="atmega328p" />
<Variable name="UPLOAD_BAUDRATE" value="115200" />
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
Now the compilation logs:
-------------- Build file: Arduino Uno in test_3 (compiler: GNU GCC Compiler for AVR)---------------
avr-g++ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -Os -mmcu=atmega328p -D__AVR_ATmega328P__ -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/libraries -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/standard -I/home/az/bin/arduino-1.6.5-r5/hardware/tools/ -c sketch.cpp -o .objs/sketch.o
sketch.cpp: In function 'void setup()':
sketch.cpp:11:2: error: 'Serial' was not declared in this scope
Serial.begin(9600);
^
sketch.cpp:15:14: error: 'OUTPUT' was not declared in this scope
pinMode(13, OUTPUT);
^
sketch.cpp:15:20: error: 'pinMode' was not declared in this scope
pinMode(13, OUTPUT);
^
sketch.cpp: In function 'void loop()':
sketch.cpp:20:2: error: 'Serial' was not declared in this scope
Serial.println("Hello world!");
^
sketch.cpp:22:19: error: 'HIGH' was not declared in this scope
digitalWrite(13, HIGH); // set the LED on
^
sketch.cpp:22:23: error: 'digitalWrite' was not declared in this scope
digitalWrite(13, HIGH); // set the LED on
^
sketch.cpp:23:12: error: 'delay' was not declared in this scope
delay(1000); // wait for a second
^
sketch.cpp:24:19: error: 'LOW' was not declared in this scope
digitalWrite(13, LOW); // set the LED off
^
Process terminated with status 1 (0 minute(s), 0 second(s))
8 error(s), 0 warning(s) (0 minute(s), 0 second(s))
That is the progress for now.
As far as the template goes.
So if i right click on the "arduino project" in the wizard i get the message below.
The "ls -l ~/.local/share/codeblocks/templates/wizard/arduino/" is empty.
So i took step back and tried to compile the files by hand ( without CB).
Here is what i learned.
The ino file (in it's simplified form) is converted to a cpp with 3 lines:
// save as Blink.cpp
#include "Arduino.h"
void setup();
void loop();
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
that can be compiled with :
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I. -I${CORE} Blink.cpp
where CORE - /home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino
Next step up was to understand how Arduino (IDE) compiles the sketches (ino files).
It seems that it copies *.cpp and *.c file to a temp directory adds a "Blink.cpp" and compiles them one by one then it links them all into one file before uploading to a board.
The arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/main.cpp is the actual "main" file, that calls all the functions from "Blink":
#include <Arduino.h>
// Declared weak in Arduino.h to allow user redefinitions.
int atexit(void (* /*func*/ )()) { return 0; }
// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }
int main(void)
{
init();
initVariant();
#if defined(USBCON)
USBDevice.attach();
#endif
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
Summary so far:
a. arduino converts "ino" files to cpp by adding 3 lines to the top of the ino file.
b. arduino copies all the c/cpp files into single temp location. One of these files is "main.cpp" that has calls to the functions in the Blink.cpp
c. then arduino calls g++ to compile each of these files separately and links them into one file
d. once completed, the file gets uploaded to the board.
So the cb project (probably) needs to make a copy of that main.cpp. and treat all "sketches" as libraries.
Next, since arduino copies all cpp/c files into one temp location and compiles and links them there, i would think, that either project wizard should do that or CB should use a build system.
P.S. cool. i just found the up-to-date ( and up to latest arduino version) build system - https://github.com/sudar/Arduino-Makefile
I suspect Tim will yell at me again for not posting the complete log...
But here the entire log from "build log":
-------------- Clean: Arduino Uno in test_3 (compiler: GNU GCC Compiler for AVR)---------------
Cleaned "test_3 - Arduino Uno"
-------------- Build: Arduino Uno in test_3 (compiler: GNU GCC Compiler for AVR)---------------
avr-g++ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -Os -mmcu=atmega328p -D__AVR_ATmega328P__ -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/libraries -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/standard -I/home/az/bin/arduino-1.6.5-r5/hardware/tools/ -c main.cpp -o .objs/main.o
avr-g++ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -Os -mmcu=atmega328p -D__AVR_ATmega328P__ -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/libraries -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/standard -I/home/az/bin/arduino-1.6.5-r5/hardware/tools/ -c sketch.cpp -o .objs/sketch.o
avr-g++ -L/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr -o bin/Release/test_3.elf .objs/main.o .objs/sketch.o -Wl,--gc-sections -s -mmcu=atmega328p
.objs/main.o: In function `main':
main.cpp:(.text.startup.main+0x0): undefined reference to `init'
.objs/sketch.o: In function `setup':
sketch.cpp:(.text.setup+0xa): undefined reference to `Serial'
sketch.cpp:(.text.setup+0xc): undefined reference to `Serial'
sketch.cpp:(.text.setup+0xe): undefined reference to `HardwareSerial::begin(unsigned long, unsigned char)'
sketch.cpp:(.text.setup+0x16): undefined reference to `pinMode'
.objs/sketch.o: In function `loop':
sketch.cpp:(.text.loop+0x4): undefined reference to `Serial'
sketch.cpp:(.text.loop+0x6): undefined reference to `Serial'
sketch.cpp:(.text.loop+0x8): undefined reference to `Print::println(char const*)'
sketch.cpp:(.text.loop+0x10): undefined reference to `digitalWrite'
sketch.cpp:(.text.loop+0x1c): undefined reference to `delay'
sketch.cpp:(.text.loop+0x24): undefined reference to `digitalWrite'
sketch.cpp:(.text.loop+0x30): undefined reference to `delay'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
13 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I have 3 files in the project - main.cpp, sketch.cpp and pins_arduino.h .
I got the linked to Wizard to work. https://github.com/obfuscated/cb_arduino_template (https://github.com/obfuscated/cb_arduino_template)
#include <Arduino.h>
/*
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup()
{
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
My Full build log is too large to put in code tags ( total message was over 20,000 characters).
No idea of what fixes I did in the past; this is NOT the first time I tried to use this wizard; will try to post what I think is needed later today.
Edit: Attached log.
Tim S.
I think I have the steps I used.
https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt)
The steps in link above are in the Code Tags below; no idea where the idea for the steps came from; I did them in trial and error using info found on Internet.
## Code::Blocks IDE should already be installed.
## But, the Code::Blocks IDE should NOT be running!
# See if arduino wizard exists already.
ls /usr/share/codeblocks/templates/wizard/arduino/
# If not copy form the location it was downloaded.
cd ~ && pwd # /home/stahta01
su # Enter su mode
cp -p --recursive /home/stahta01/cb_arduino_template-master/ /usr/share/codeblocks/templates/wizard/arduino/
exit # Exit su mode
# Start Code::Blocks IDE
# Check if the "Arduino Project" Wizard exists.
# If "Arduino Project" wizard missing, add the next line to the startup script.
RegisterWizard(wizProject, _T("arduino"), _T("Arduino Project"), _T("Embedded Systems"));
## Run "Arduino Project" Wizard; I used "Arduino Uno" option to test.
# First error I get when building "Arduino Uno" Project.
fatal error: CDC.cpp: No such file or directory
mkdir -p ~/.codeblocks
cd ~/.codeblocks
ln -s ~/sketchbook sketches
pwd # /home/stahta01/.codeblocks
su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit # su mode
Tim S.
Now a new issue - there is no autocompletion.
CB log:
Scanning for lexers in /usr/share/codeblocks/lexers/...
Found 56 lexers
Loading lexer_ada
Loading lexer_d
Loading lexer_A68k
Loading lexer_xml
Loading lexer_java
Loading lexer_srec
Loading lexer_html
Loading lexer_OgreMaterial
Loading lexer_python
Loading lexer_f77
Loading lexer_pascal
Loading lexer_smalltalk
Loading lexer_bash
Loading lexer_perl
Loading lexer_latex
Loading lexer_cu
Loading lexer_cpp
Loading lexer_css
Loading lexer_angelscript
Loading lexer_hitasm
Loading lexer_lua
Loading lexer_masm
Loading lexer_postscript
Loading lexer_registry
Loading lexer_haskell
Loading lexer_vhdl
Loading lexer_inno
Loading lexer_squirrel
Loading lexer_ihex
Loading lexer_cmake
Loading lexer_properties
Loading lexer_verilog
Loading lexer_matlab
Loading lexer_proto
Loading lexer_autotools
Loading lexer_caml
Loading lexer_nsis
Loading lexer_make
Loading lexer_prg
Loading lexer_glsl
Loading lexer_batch
Loading lexer_vbscript
Loading lexer_gm
Loading lexer_OgreCompositor
Loading lexer_bibtex
Loading lexer_tehex
Loading lexer_cg
Loading lexer_ruby
Loading lexer_javascript
Loading lexer_coffee
Loading lexer_sql
Loading lexer_lisp
Loading lexer_rc
Loading lexer_fortran
Loading lexer_diff
Loading lexer_objc
Configured 0 tools
Scanning for plugins in /home/az/.local/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /usr/lib64/codeblocks/plugins
Tools Plus Plugin: Registering shell type Piped Process Control
Loaded 57 plugins
Loading:
ProjectOptionsManipulator
ToolsPlus
IncrementalSearch
Debugger
ReopenEditor
HelpPlugin
HeaderFixup
CodeStat
FilesExtensionHandler
ScriptedWizard
Profiler
MouseSap
cbKeyBinder
SmartIndentXML
SmartIndentCpp
Abbreviations
FileManager
lib_finder
copystrings
Exporter
CppCheck
HexEditor
RegExTestbed
ClassWizard
Valgrind
Compiler
ProjectsImporter
EnvVars
CodeCompletion
EditorConfig
ThreadSearch
BrowseTracker
SpellChecker
SpellChecker: Thesaurus files '/usr/share/mythes/th_en_US.idx' not found!
SpellChecker: Loading '/usr/share/mythes/th_en_US_v2.idx' instead...
EditorTweaks
CB_Koders
AStylePlugin
SmartIndentPython
AutoVersioning
Cscope
OpenFilesList
Cccc
CodeSnippets
Autosave
cbDragScroll
OccurrencesHighlighting
ToDoList
SymTab
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'
Opening /home/az/Dropbox/work//Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/Makeprj.cbp
Done.
Current compiler 'GNU GCC Compiler for AVR' doesn't have correctly defined debugger!
NativeParser::CreateParser(): Finish creating a new parser for project 'Makeprj'
NativeParser::OnParserEnd(): Project 'Makeprj' parsing stage done!
log from project loading:
OccurrencesHighlighting plugin activated
Todo List plugin activated
Symbol Table Plugin plugin activated
Loading toolbar...
Initializing plugins...
Loading project file...
Parsing project file...
Loading target Debug
Loading target Release
Loading project files...
1 files loaded
Done loading project in 1ms
Project's base path: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/
Project's common toplevel path: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 41)
Editor Open
Project data set for /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
Top Editor: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/avr/include
NativeParser::AddCompilerPredefinedMacrosGCC: Caching predefined macros for compiler '/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-g++':
#define __DBL_MIN_EXP__ (-125)
<skip>
NativeParser::DoFullParsing(): AddProjectDefinedMacros failed!
NativeParser::DoFullParsing(): Adding cpp/c files to batch-parser
NativeParser::DoFullParsing(): Added 1 source file(s) for project 'Makeprj' to batch-parser...
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
NativeParser::CreateParser(): Finish creating a new parser for project 'Makeprj'
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::OnParserStart(): Starting batch parsing for project 'Makeprj'...
NativeParser::OnParserEnd(): Project 'Makeprj' parsing stage done!
Project 'Makeprj' parsing stage done (2 total parsed files, 425 tokens in 0 minute(s), 0.005 seconds).
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Traversing ' - /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/ , 179
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include/ , 13
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed/ , 3
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/avr/include/ , 307
SystemHeadersThread: Total number of paths: 4
Auto-completion is sort of working with Search Directories -> Compiler set to:
/home/az/bin/arduino-1.6.5-r5/libraries
/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino
/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/libraries
So if i take :
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
#include <Arduino.h>
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
}
void loop()
{
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}
delay(500);
}
and type #include < there will be a list of h files, but there will be no "wire.h". There will be Wire/Wire.h though. Once i add wire.h and wire. will expend after the first symbol.
At the same time "Serial." would not expend at all.
File compiles fine.
FYI: A problem on Windows that I have been ignoring is I get this message below.
Arduino Project has failed to load XRC resource...
I have been thinking I need to test with wxWidgets 3.0 to see if the message goes away.
But, I have NOT yet had time to do any testing.
Have you tested on any Linux that uses wxWidgets 2.8?
Tim S.
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.
awesome news! let me try on Fedora 22. I'll update the thread in next 2 days
UPDATE:
cb start:
[az@toshiba ~]$ codeblocks
Warning: Mismatch between the program and library build versions detected.
The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1008,wx containers,compatible with 2.4,compatible with 2.6),
and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1009,wx containers,compatible with 2.4,compatible with 2.6).
Starting Code::Blocks svn build rev 10868 Jun 14 2016, 05:59:11 - wx2.8.12 (Linux, unicode) - 64 bit
Initialize EditColourSet .....
Initialize EditColourSet: done.
.....
And the error message is attached as a snapshot:
Filename: /home/az/.local/share/codeblocks/templates/wizard//config.script
Error: the index 'RegisterWizard' does not exist
Details:
AN ERROR HAS OCCURED [the index 'RegisterWizard' does not exist]
CALLSTACK
*FUNCTION [main()] /home/az/.local/share/codeblocks/templates/wizard//config.script line [1]
LOCALS
[this] TABLE
Also in the log i see:
....
Help plugin plugin activated
Header Fixup plugin activated
Code statistics plugin activated
Files extension handler plugin activated
(codeblocks:2314): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 18 and height -16
Similiar error was posted here (forums.codeblocks.org/index.php?action=post;msg=145176;topic=21252.15) with the resolution :
This doesn't work because wxArrayString::Item is missing from the squirrel bindings your version of c::b.
The first fixed version is rev10400. So you need to install a recent night build or the latest stable build 16.01.
wxWidgets are:
rpm -qa | grep wx
wxGTK-2.8.12-16.fc22.x86_64
wxBase-2.8.12-16.fc22.x86_64
tried all versions until codeblocks.x86_64 16.01.svn.10827-1.fc22 with no positive results.
Error: the index 'RegisterWizard' does not exist
The above happens if you do NOT have the scriptedWizard plugin installed and enabled.
Edit: All your other issues; are NOT related to the CB Wizard change.
Tim S.
Error: the index 'RegisterWizard' does not exist
The above happens if you do NOT have the scriptedWizard plugin installed and enabled.
Edit: All your other issues; are NOT related to the CB Wizard change.
Tim S.
hmm.. doesn't look like this is the case. See attached.
Also, if i disable the plugin the CB starts wo issues. And once i enable it it (CB) immediately complains with the above mentioned message.
I should note that the READ.ME states:
Add the following two lines in the RegisterWizards function insde the file ~/.local/share/codeblocks/templates/wizard/config.script
but i did not have this file.
[az@toshiba wizard]$ pwd
/home/az/.local/share/codeblocks/templates/wizard
[az@toshiba wizard]$ ls -l
total 4
lrwxrwxrwx 1 az az 41 Jun 26 13:06 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-rw-r-- 1 az az 174 Jun 26 22:52 config.script
[az@toshiba wizard]$ cat ./config.script
RegisterWizard(wizProject, _T("arduino"), _T("Arduino Project"), _T("Embedded Systems"));
RegisterWizard(wizTarget, _T("arduino"), _T("Arduino"),_T("Embedded Systems"));
UPDATE 2:
if i to remove the config.script then CB will load wo issues and the "Arduino project" template will be colored red. once i select it in the attempt to create a new project i'll get "Arduino Project has failed to load XRC resource..." . See below attached.
After that the wizards starts normally.
Once i load the sketch.cpp the "invalid variable" dialog pops up. Doesn't matter what i clikc ( yes/no) the dialog gets created again and again. the way out is to specify the "base" path and click (as many times as needed) the "Yes" button until the dialog goes away.
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.
Instead of adding 2 "RegisterWizard" lines to the local user's config file, i added (for testing purposes) to the global /usr/share/codeblocks/templates/wizard/config.script.
the New (arduino, arduino) line created a new build target "Arduino". Both "Arduino" and "Arduino Project" wizards are red now and have exact same behavior (same errors, same list of options to select).
The only difference is :
Initializing plugins...
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 41)
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/cb_arduino_template' for: wizard.*
NativeParser::GetAllPathsByFilename(): Found 0 files:
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
when i select a new "Arduino" build target.
Have you followed all the steps in the README?
Can you paste the output of these two commands:
find ~/.config/codeblocks/ -ls
find ~/.local/share/codeblocks/ -ls
I renamed config to config1 to be able to load the CB.
Here you go:
[az@toshiba arduino]$ find /home/az/.local/share/codeblocks/ -ls
8929285 4 drwxr-xr-x 5 az az 4096 Jun 26 13:05 /home/az/.local/share/codeblocks/
8929286 4 drwxr-xr-x 2 az az 4096 Apr 16 00:12 /home/az/.local/share/codeblocks/plugins
8929287 4 drwxr-xr-x 2 az az 4096 Apr 16 00:12 /home/az/.local/share/codeblocks/scripts
9964835 4 drwxr-xr-x 3 az az 4096 Jun 17 16:56 /home/az/.local/share/codeblocks/templates
9964836 4 drwxr-xr-x 2 az az 4096 Jun 27 20:24 /home/az/.local/share/codeblocks/templates/wizard
9962694 0 lrwxrwxrwx 1 az az 41 Jun 26 13:06 /home/az/.local/share/codeblocks/templates/wizard/arduino -> /home/az/work/Arduino/cb_arduino_template
9962693 4 -rw-rw-r-- 1 az az 82 Jun 27 20:23 /home/az/.local/share/codeblocks/templates/wizard/config.script1
and :
[az@toshiba arduino]$ find /home/az/.config/codeblocks/ -ls
8929288 8 drwxr-xr-x 3 az az 4096 Jun 27 20:24 /home/az/.config/codeblocks/
8913529 40 -rw-rw-r-- 1 az az 35735 Jun 11 11:27 /home/az/.config/codeblocks/cbKeyBinder10.ini.bak
8923417 8 -rw-rw-r-- 1 az az 282 Jun 21 16:34 /home/az/.config/codeblocks/default.workspace.layout
8914275 8 -rw-rw-r-- 1 az az 231 Jun 26 13:54 /home/az/.config/codeblocks/DragScroll.ini
8912998 40 -rw-rw-r-- 1 az az 35672 Jun 26 13:40 /home/az/.config/codeblocks/cbKeyBinder10.ini
8913560 8 -rw-rw-r-- 1 az az 128 Jun 11 11:27 /home/az/.config/codeblocks/BrowseTracker.ini
8915296 4 -rw-rw-r-- 1 az az 0 Jun 26 13:54 /home/az/.config/codeblocks/en_US_personaldictionary.dic
8914276 136 -rw-rw-r-- 1 az az 131347 Jun 27 20:24 /home/az/.config/codeblocks/default.conf
8913557 8 -rw-rw-r-- 1 az az 223 Apr 21 19:11 /home/az/.config/codeblocks/default.workspace.save
8914251 8 -rw-rw-r-- 1 az az 233 Jun 26 13:54 /home/az/.config/codeblocks/codesnippets.ini
9964829 8 drwxrwxr-x 3 az az 4096 Jun 16 15:40 /home/az/.config/codeblocks/share
9964830 8 drwxrwxr-x 3 az az 4096 Jun 16 15:40 /home/az/.config/codeblocks/share/codeblocks
9964831 8 drwxrwxr-x 3 az az 4096 Jun 16 15:40 /home/az/.config/codeblocks/share/codeblocks/templates
9964832 8 drwxrwxr-x 2 az az 4096 Jun 16 15:41 /home/az/.config/codeblocks/share/codeblocks/templates/wizard
9964797 0 lrwxrwxrwx 1 az az 54 Jun 16 15:41 /home/az/.config/codeblocks/share/codeblocks/templates/wizard/cb_arduino_template-master -> /home/az/.config/codeblocks/cb_arduino_template-master
now i removed the /home/az/.config/codeblocks/share/codeblocks/templates/wizard/cb_arduino_template-master abd renamed config1 to config - same errors persist even if i have only one line in the config:
[az@toshiba wizard]$ ls -l
total 4
lrwxrwxrwx 1 az az 41 Jun 26 13:06 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-rw-r-- 1 az az 82 Jun 27 20:23 config.script
[az@toshiba wizard]$ cat ./config.script
RegisterWizard(wizTarget, _T("arduino"), _T("Arduino"),_T("Embedded Systems"));
[az@toshiba wizard]$
codeblocks-contrib:
[az@toshiba wizard]$ rpm -qa | grep codebl
codeblocks-16.01.svn.10868-1.fc22.x86_64
codeblocks-libs-16.01.svn.10868-1.fc22.x86_64
codeblocks-contrib-libs-16.01.svn.10827-1.fc22.x86_64
[az@toshiba wizard]$ rpm -ql codeblocks-contrib-libs-16.01.svn.10827-1.fc22.x86_64
/usr/lib64/codeblocks/wxContribItems/libwxchartctrl.so.0
/usr/lib64/codeblocks/wxContribItems/libwxchartctrl.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxcustombutton.so.0
/usr/lib64/codeblocks/wxContribItems/libwxcustombutton.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxflatnotebook.so.0
/usr/lib64/codeblocks/wxContribItems/libwxflatnotebook.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwximagepanel.so.0
/usr/lib64/codeblocks/wxContribItems/libwximagepanel.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxkwic.so.0
/usr/lib64/codeblocks/wxContribItems/libwxkwic.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxled.so.0
/usr/lib64/codeblocks/wxContribItems/libwxled.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxmathplot.so.0
/usr/lib64/codeblocks/wxContribItems/libwxmathplot.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxspeedbutton.so.0
/usr/lib64/codeblocks/wxContribItems/libwxspeedbutton.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxtreelist.so.0
/usr/lib64/codeblocks/wxContribItems/libwxtreelist.so.0.0.1
/usr/lib64/libwxsmithlib.so.0
/usr/lib64/libwxsmithlib.so.0.0.1
/usr/share/doc/codeblocks-contrib-libs
/usr/share/doc/codeblocks-contrib-libs/AUTHORS
/usr/share/doc/codeblocks-contrib-libs/BUGS
/usr/share/doc/codeblocks-contrib-libs/COMPILERS
/usr/share/doc/codeblocks-contrib-libs/COPYING
/usr/share/doc/codeblocks-contrib-libs/ChangeLog
/usr/share/doc/codeblocks-contrib-libs/NEWS
/usr/share/doc/codeblocks-contrib-libs/README
/usr/share/doc/codeblocks-contrib-libs/TODO
Try these two commands; to create the file and then try editing it. I am mainly a windows person; so, these may or may NOT work.
Tim S.
mkdir -p ~/.local/share/codeblocks/templates/wizard
cp /usr/share/codeblocks/templates/wizard/config.script ~/.local/share/codeblocks/templates/wizard/config.script
Unfortunately, i still get the "Arduino Project has failed to load XRC resource..." warning/error and the "global variable" dialog runs wild (creates tons of windows) and eventually terminates the CB.
I get the "Arduino Project has failed to load XRC resource..." warning/error on Windows (it uses wx2.8 ); I am guessing it is a wxWidgets 2.8 issue; I have NOT had time to confirm it.
No idea why you get "global variable" dialog runs wild on Linux; I was thinking only Windows used a CB "global variable" while Linux used a linked file/directory solution.
How did you do the linked file/directory solution?
Here is my notes on what I used recently on Linux (Debian testing).
Note: I am NOT sure this code below is good or NOT.
cd ~/.codeblocks
ln -s ~/sketchbook sketches
## If self built arduino IDE
cd ~/.codeblocks
ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino
pwd # /home/stahta01/.codeblocks
## If used Debian Installer for arduino IDE
su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit # su mode
Tim S.
Unfortunately, i still get the "Arduino Project has failed to load XRC resource..." warning/error and the "global variable" dialog runs wild (creates tons of windows) and eventually terminates the CB.
I get the "Arduino Project has failed to load XRC resource..." warning/error on Windows (it uses wx2.8 ); I am guessing it is a wxWidgets 2.8 issue; I have NOT had time to confirm it.
No idea why you get "global variable" dialog runs wild on Linux; I was thinking only Windows used a CB "global variable" while Linux used a linked file/directory solution.
How did you do the linked file/directory solution?
Here is my notes on what I used recently on Linux (Debian testing).
Note: I am NOT sure this code below is good or NOT.
cd ~/.codeblocks
ln -s ~/sketchbook sketches
## If self built arduino IDE
cd ~/.codeblocks
ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino
pwd # /home/stahta01/.codeblocks
## If used Debian Installer for arduino IDE
su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit # su mode
Tim S.
> How did you do the linked file/directory solution?
I followed the read.me to the dot.
here is what i have :
[az@toshiba wizard]$ pwd
/home/az/.local/share/codeblocks/templates/wizard
[az@toshiba wizard]$ ls -la
total 20
drwxr-xr-x 2 az az 4096 Jun 29 00:03 .
drwxr-xr-x 3 az az 4096 Jun 17 16:56 ..
lrwxrwxrwx 1 az az 41 Jun 29 00:03 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-r--r-- 1 az az 6258 Jun 29 00:02 config.script
ls -la /home/az/.local/share/codeblocks/
total 24
drwxr-xr-x 5 az az 4096 Jun 26 13:05 .
drwxr-xr-x. 19 az az 4096 Jun 29 00:17 ..
drwxr-xr-x 2 az az 4096 Apr 16 00:12 plugins
drwxr-xr-x 2 az az 4096 Apr 16 00:12 scripts
drwxr-xr-x 3 az az 4096 Jun 17 16:56 templates
all dirs but "templates" are empty.
I don't have any links to sketches.
To avoid recreation of the dialog i have to click "NO" as many time as it pops up. And managed to set the directory and save that. If i'm lucky i get the CB working fine, if not - "process terminated"
I see your problem; somewhere recently he changed the Wizard to use an CB "Global Variable" instead of Linking file/folder solution; but, I did NOT do that change on Linux.
(But, I forgot if I tested the wizard on Linux or not after he asked.)
I will see what the Global Variable is supposed to be.
The base location of the Global Variable needed to be "/home/stahta01/devel/open_source_code/version_control/arduino_ide-git" for me.
( I just tested this location "/home/stahta01/devel/open_source_code/version_control/arduino_ide-git/build/linux/work" and it also worked for me.)
ls /home/stahta01/devel/open_source_code/version_control/arduino_ide-git
The results of the above list needs to contain at least the folders "hardware" and "libraries".
My folders below.
app arduino-core build examples_formatter.conf format.every.sketch.sh hardware libraries lib_sync license.txt README.md work
In doing my solution I had to edit an header search path in the Wizard created project
from "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID/src"
to "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID"
Sorry, about the confusion; I missed when he did the change to Global Variable under Linux.
To create a CB "Global Variable" use
Setting -> "Global Variables ..."
Click on "New" (By the current variable) enter "arduino" for the name of the variable.
I have attached an image of the window below.
Tim S.
Hi,
I've install cb_arduino_template, created a test project and compiled it with no errors. When I attempted uploading it (I pressed 'Run', is that the way to do it?) I got a terminal window with the following error:
/home/.../cb_arduino_wizard_test/bin/uno/cb_arduino_wizard_test.elf: 1: /home/.../cb_arduino_wizard_test/bin/uno/cb_arduino_wizard_test.elf: Syntax error: "(" unexpected
System info:
Xubuntu 16.04
CB 16.01
Arduino 1.6.9
Thanks