Code::Blocks Forums

User forums => Help => Topic started by: phamtv on July 03, 2014, 09:24:04 pm

Title: Getting started with Code::Block
Post by: phamtv on July 03, 2014, 09:24:04 pm
I just realized that I will have to create custom plugins in order to integrate support for my embedded devices into Code::Block. Thus, I have a couple of newbie questions:

1. I successfully downloaded and recompiled the CodeBlocks Workspace wx2.8.x (Unix) using Code::Block.  However, I cannot seem to run/debug the application.  I clicked on the Debug->Start menu option. Immediately, I get a pop-up dialog prompting to select a target.  I tried all of them but cannot seem to get the correct target that will start the app (main.cpp).

2.  Are there references/guides on how to create a complex plugin?  My goal is to design and implement something similar to the EPS Debugger plugin suite.

Thanks in advance for your time and support!
Title: Re: Getting started with Code::Block
Post by: oBFusCATed on July 03, 2014, 09:32:05 pm
1.  Generally all targets should be able to start C::B. The one specifically for the application is "src". Keep in mind that you have to run the update.sh file before starting C::B.
2. No, Look in the source. You need to look at cbDebuggerPlugin.

p.s. the EPS Debugger seems to be doing most of the Debugger UI separately without using available dialogs/APIs.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 03, 2014, 09:55:10 pm
Thanks oBFusCATed for the quick response!  I am looking through the directories for update.sh but cannot locate the .sh file.  I've located: update, update29, and update30 plain text documents in codeblocks-13.12/src folder.  Are these the one you are referencing?

Best regards.
Title: Re: Getting started with Code::Block
Post by: Jenna on July 03, 2014, 10:51:24 pm
On linux with wx2.8 ./update is what you need to run.
Some other shell-scripts (needed with autotools) have the .sh extensions.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 08, 2014, 05:44:53 pm
Thanks for the reply Jen!  I am running into another issue I can't resolve.  I followed your instructions to get all the lib references/tools (from http://forums.codeblocks.org/index.php?topic=15137.0) in order to compile code::block source code.  However, when I try to build the "File Manager Plugin" project using Code::Block, I get errors indicated below even though I've done the sudo apt-get install command to retrieve the libgamin-dev libraries.  

- undefined reference to FAMOpen
- undefined reference to FAMClose
- undefined reference to FAMCancelMonitor
- undefined reference to FAMMonitorDirectory
- undefined reference to FAMNextEvent
- undefined reference to FAMPending

Any suggestions how I can resolve this?
Title: Re: Getting started with Code::Block
Post by: oBFusCATed on July 08, 2014, 08:08:35 pm
Install developers packages for famin, gamin or whatever clone/implementation you have in your distro.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 08, 2014, 08:33:31 pm
I have already installed gamin.  Prior to doing so, the error I was getting was "fam.h" file/directory was not found.  Thus I ran sudo apt-get installed libgamin-dev and verified that /usr/include/fam.h was installed.  It seems like codeblock's source included fam.h file but for some reason cannot find the extern functions declared in fam.h (FAMOpen, FAMClose, etc...)  Please advise.
Title: Re: Getting started with Code::Block
Post by: oBFusCATed on July 08, 2014, 08:42:36 pm
You have to check the build log to see what library is used for linking and then check if this library provides the needed symbols. See the manual for nm or objdump.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 08, 2014, 10:25:31 pm
I ran nm on the file "directorymonitor.o" and got the following output:

Code
0000000000000000 V DW.ref.__gxx_personality_v0
                 U FAMCancelMonitor
                 U FAMClose
                 U FAMMonitorDirectory
                 U FAMNextEvent
                 U FAMOpen
                 U FAMPending
                 U _GLOBAL_OFFSET_TABLE_
....

If I am not wrong, I think the "U" means that the symbol is undefined which is why I am receiving the "undefined reference" messages???

Am I missing something in order to get code::block source to compile successfully?

Best regards.
Title: Re: Getting started with Code::Block
Post by: stahta01 on July 08, 2014, 11:10:19 pm
You have to check the build log to see what library is used for linking and then check if this library provides the needed symbols. See the manual for nm or objdump.

What libraries are being linked in the "Build Log"?

Tim S.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 08, 2014, 11:56:26 pm
the build log is as follow:

Code

-------------- Clean: default in File Manager Plugin (Unix) (compiler: GNU GCC Compiler)---------------

Cleaned "File Manager Plugin (Unix) - default"

-------------- Build: default in File Manager Plugin (Unix) (compiler: GNU GCC Compiler)---------------

g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp -o ../../../.objs/plugins/contrib/FileManager/directorymonitor.o
g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorer.cpp -o ../../../.objs/plugins/contrib/FileManager/FileExplorer.o
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorer.cpp: In member function ‘int VCSstatearray::Index(const _wxObjArrayVCSstatearray&, bool) const’:
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorer.cpp:27:1: warning: declaration of ‘Item’ shadows a member of 'this' [-Wshadow]
g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorerSettings.cpp -o ../../../.objs/plugins/contrib/FileManager/FileExplorerSettings.o
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorerSettings.cpp: In member function ‘int FavoriteDirs::Index(const _wxObjArrayFavoriteDirs&, bool) const’:
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorerSettings.cpp:14:1: warning: declaration of ‘Item’ shadows a member of 'this' [-Wshadow]
g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileExplorerUpdater.cpp -o ../../../.objs/plugins/contrib/FileManager/FileExplorerUpdater.o
g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/FileManager.cpp -o ../../../.objs/plugins/contrib/FileManager/FileManager.o
g++ -Wshadow -Winit-self -Wunreachable-code -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wextra -Wall -ansi -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -Winvalid-pch -fmessage-length=0 -fexceptions -fPIC -DcbDEBUG -DCB_PRECOMP -D__FAM__ -g -I../../../include -I../../../sdk/wxscintilla/include -I../../../include/mozilla_chardet -I../../../include/mozilla_chardet/mfbt -I../../../include/mozilla_chardet/nsprpub/pr/include -I../../../include/mozilla_chardet/xpcom -I../../../include/mozilla_chardet/xpcom/base -I../../../include/mozilla_chardet/xpcom/glue -c /home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/se_globals.cpp -o ../../../.objs/plugins/contrib/FileManager/se_globals.o
g++ -shared -L../../../devel -L/usr/include ../../../.objs/plugins/contrib/FileManager/directorymonitor.o ../../../.objs/plugins/contrib/FileManager/FileExplorer.o ../../../.objs/plugins/contrib/FileManager/FileExplorerSettings.o ../../../.objs/plugins/contrib/FileManager/FileExplorerUpdater.o ../../../.objs/plugins/contrib/FileManager/FileManager.o ../../../.objs/plugins/contrib/FileManager/se_globals.o  -o ../../../devel/share/codeblocks/plugins/libFileManager.so -L/usr/lib/x86_64-linux-gnu -pthread -Wl,-Bsymbolic-functions -Wl,-z,relro  -L/usr/lib/x86_64-linux-gnu   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8   -Wl,--no-undefined  -lcodeblocks
../../../.objs/plugins/contrib/FileManager/directorymonitor.o: In function `MonDescriptors':
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:36: undefined reference to `FAMOpen'
../../../.objs/plugins/contrib/FileManager/directorymonitor.o: In function `~MonDescriptors':
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:41: undefined reference to `FAMClose'
../../../.objs/plugins/contrib/FileManager/directorymonitor.o: In function `DirMonitorThread::UpdatePathsThread(MonDescriptors&)':
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:117: undefined reference to `FAMCancelMonitor'
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:133: undefined reference to `FAMMonitorDirectory'
../../../.objs/plugins/contrib/FileManager/directorymonitor.o: In function `DirMonitorThread::Entry()':
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:172: undefined reference to `FAMNextEvent'
/home/phamtv/Downloads/codeblocks-13.12/src/plugins/contrib/FileManager/directorymonitor.cpp:169: undefined reference to `FAMPending'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 13 second(s))
6 error(s), 2 warning(s) (0 minute(s), 13 second(s))
 

Title: Re: Getting started with Code::Block
Post by: stahta01 on July 09, 2014, 12:01:15 am
Quote
Install developers packages for famin, gamin or whatever clone/implementation you have in your distro.

So you have no library listed to supply the missing functions.
Which one do you have installed on your system?

I suggest seeing if you have famin or gamin installed; then, linking to the one you have installed.

Tim S.

Title: Re: Getting started with Code::Block
Post by: phamtv on July 09, 2014, 12:12:47 am
I've done a sudo apt-get install libgamin-dev.  I assume this installs the package right?
Title: Re: Getting started with Code::Block
Post by: stahta01 on July 09, 2014, 12:15:18 am
I've done a sudo apt-get install libgamin-dev.  I assume this installs the package right?

No, it installs the development files.

I would guess
sudo apt-get install libgamin
or
sudo apt-get install gamin

As the correct command to install gamin.

Tim S.
Title: Re: Getting started with Code::Block
Post by: oBFusCATed on July 09, 2014, 12:18:04 am
@phamtv:
Yes this is what is needed.
Have you restarted C::B after you've installed it? C::B caches all pkg-config calls and this causes problems if you install stuff after you've started C::B.

Do you get proper output from this command: pkg-config --libs gamin ?

@stahta01:
Most of the times -dev packages have explicit dependency on the -lib or other required packages.
Title: Re: Getting started with Code::Block
Post by: phamtv on July 09, 2014, 04:46:02 pm
Thanks guys!!!!  I think rebooting C::B resolved my problem.
Title: Re: Getting started with Code::Block
Post by: comsytec on July 13, 2014, 09:44:30 pm

2.  Are there references/guides on how to create a complex plugin?  My goal is to design and implement something similar to the EPS Debugger plugin suite.


For which linux distro ? or Mac OS X ? (porting is currently in development)