News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Getting started with Code::Block

Started by phamtv, July 03, 2014, 09:24:04 PM

Previous topic - Next topic

phamtv

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!

oBFusCATed

#1
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

phamtv

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.

Jenna

On linux with wx2.8 ./update is what you need to run.
Some other shell-scripts (needed with autotools) have the .sh extensions.

phamtv

#4
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.next.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?

oBFusCATed

Install developers packages for famin, gamin or whatever clone/implementation you have in your distro.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

phamtv

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.

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

phamtv

I ran nm on the file "directorymonitor.o" and got the following output:


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.

stahta01

Quote from: 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.

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

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

phamtv

the build log is as follow:



-------------- 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))



stahta01

QuoteInstall 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.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

phamtv

I've done a sudo apt-get install libgamin-dev.  I assume this installs the package right?

stahta01

Quote from: 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?

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

@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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]