|
YoLinux Tutorials:
°YoLinux Tutorials Index
Free Information Technology Magazine Subscriptions and Document Downloads
Free Information Technology Software and Development Magazine Subscriptions and Document Downloads
|
| C++ GUI Framework Toolkits: |
Cross platform (Linux, MS/Windows, IRIX, Solaris (Gnome will be standard on Solaris 10))
GUI Framework links:
| C++ Graphic Componets and Widgets: |
- SL.com - Sherrill - Lubinski SL-GMS
Dynamic graphic GUI components and controls for real time interfaces and displays. Common ".m1" file graphic framework for
C++ and Java. Graphic sources include Visio, bitmaps and DXF. Supports pan, zoom, drill-down and hyperlink capability.
Supports input as well as displays.
- Kinesix.com: Sammi - Similar to SL-GMS but not as good.
- Genlogic.com: GLG - Dynamic, data driven visual components.
- INT.com
- ILog.com: Views - Diagraming and data graphing capabilities.
| C++ Web Server CGI Toolkits: |
- CppUnit C++ port of IBM's JAva JUnit test framework. Test report output is in XML or text.
- CxxTest - C++ test framework
- Unit++ - testing library and framework
| C/C++ Development environment for Linux: |
The following tools will provide the infrastructure for a C++ on Linux development environment:
(Eclipse IDE, SCM and the build tools are cross platform and can be duplicated on MS/Windows and other UNIX environemnts)
- IDE (Integrated Development Environment): Eclipse
Download http://eclipse.org/downloads/ - i.e. eclipse-SDK-3.1.1-linux-gtk-x86_64.tar.gz
Eclipse also requires the Java installation. See YoLinux Java download/installation
Install Eclipse:
- for all on system:
- mv eclipse-SDK-3.1.1-linux-gtk-x86_64.tar.gz /opt
- tar xzf eclipse-SDK-3.1.1-linux-gtk-x86_64.tar.gz
This installs Eclipse under /opt/eclipse
OR
- for yourself only:
- Download to your home directory.
- tar xzf eclipse-SDK-3.1.1-linux-gtk-x86_64.tar.gz
This installs Eclipse under /home/your-user-id/eclipse
Be sure to include the following Eclipse plug-ins:
[Potential Pitfall]:
If Eclipse is installed in /opt/eclipse/ for system wide use,
you may want to start Eclipse with the following command:
-
eclipse -data /home/user1/workspace
[Potential Pitfall]:
When downloading Eclipse and Eclipse plug-ins, look at the README files (eclipse/readme/readme_eclipse.html)
to see if you have a matching GTK+ release. If the version of Eclipse
and plug-ins are too new for the version of GTK+ on your system then
Eclipse may not display properly. For older versions of Linux, you may
have to install older versions of Eclipse and older plug-ins. i.e. the
latest version of Eclipse (3.1.1) on the older Red Hat Linux 8.0 will
NOT operate properly. Eclipse 3.1.1 requires GTK 2.2.1 while Red Hat
8.0 uses GTK 2.0.
[Potential Pitfall]: Don't mix 32 bit Java with 64 bit (AMD64/EM64T) Eclipse. Choose all 32 or all 64 bit for Eclipse environment.
Error in ~/workspace/.metadata/.log
-
!SESSION 2005-10-31 00:19:28.817 -----------------------------------------------eclipse.buildId=M20050929-0840 java.version=1.4.2_09 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.osgi 2005-10-31 00:19:29.787 !MESSAGE Application error !STACK 1 java.lang.UnsatisfiedLinkError: /opt/eclipse/configuration/org.eclipse.osgi/bundles/24/1/.cp/libswt-pi-gtk-3139.so: ...xxxxxxxxxxx...: cannot open shared object file: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1495) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:834) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123) at org.eclipse.swt.internal.gtk.OS.(OS.java:19) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54) at org.eclipse.swt.widgets.Display.(Display.java:122) at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:381) at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:155) at org.eclipse.ui.internal.ide.IDEApplication.createDisplay(IDEApplication.java:128) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:79) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)
|
Installing the RPM jdk-1_5_0_05-linux-amd64.rpm instead of
the i586 version of Java to run with the x86_64 version of Eclipse
fixes this problem.
Notes:
- Help/Welcome screen is default upon start-up and gives an
introduction and tutorials on Eclipse . You can later return to this
menu: "Help" + "Welcome".
- I could not find any way to enter gdb debugger
commands. The only input accepted is through the GUI. While it offers
similar capability to MS/VC++, hard core debugging is best left to ddd.
- Alternate C/C++ IDE: I can also recomend the Anjuta
IDE for C/C++ development. Solid, simple, intuitive, bug free IDE for
C/C++ development on Linux. Search/Indexing, edit, compile and debug.
Packages:
- YUM: yum install anjuta
- RPMs available from Dag Wieers: Anjuta.
- Ubuntu/Debian: apt-get install anjuta
(requires: anjuta-common, libgtk2.0-dev libgtkmm2.0-dev libgnome2-dev
libgnomemm2.0-dev devhelp-books glade-2 glade-gnome-2
cvs automake autogen indent ctags devhelp gnome-devel libtool)
- SCM (Software Configuration Management):
- Bug / issue tracking:
- Build systems:
- GNU gmake/make: GNU make is a build system based on the original UNIX "make" build system but with more features. Install RPM package: make
GNU make manual
- scons: Newer python based, cross platform build system. Great for cross platform development (i.e. MS/Windows and Linux/Unix)
- Automated Nightly/Continuous Build and reporting systems:
- File Compare Tools:
- gtkdiff: Has diff3 and merge features. Written with GTK+. After gtkdiff-0.8.0, GNOME required.
- fldiff: Graphical file and directory diff. (Cross platform)
- kdiff3:
Graphical directory and file diff, merge and edit. KDE3/Qt based.
Supports drag and drop. Comes with S.u.S.E. distro. (Cross platform)
MS/Windows download available.
- Difference: kdiff file1 file2
- Difference: kdiff file1 file2 file3
- Difference of two files: kdiff directory1/file directory2
- Difference: kdiff directory1 directory2
- Merge: kdiff directory1 directory2 -o dest-directory
- Merge: kdiff file1 file2 -m
- Merge: kdiff file1 file2 -o output-file
- Kompare: Ships with KDE SDK. [manual]
- Meld: Compare, edit and merge.
- mgdiff: [download] Motif-based graphical file difference browser and merge.
Comes with S.u.S.E. distro.
- tkdiff: [download]
- gvim and gvimdiff
- dirdiff: Directory difference viewer.
- Compiler: Install RPM packages for GNU compiler gcc, gcc-c++, binutils (linker), glibc, glibc-devel, gdb
Note:
| Coding for cross platform deployment with gcc/g++: |
The gcc/g++ compiler is compiled with a number of defined preprocessor variables.
The list of defined variables compiled into gcc/g++ can be viewed by issuing the command: g++ -dumpspecs
The defined preprocessor variables can then be used to handle platform dependencies.
| Platform |
Platform Variable Name |
Variable: unix |
Variable: posix |
Variable: _POSIX_SOURCE |
Architecture variable |
| Fedora Core 3 Linux |
linux
__gnu_linux__ |
* |
|
* |
|
| Red Hat 8 Linux |
linux
__gnu_linux__ |
* |
* |
* |
|
| Suse 9.2 Linux |
linux
__gnu_linux__ |
* |
|
|
|
| Sun Solaris/SPARC |
sparc |
|
|
|
__arch64 |
| SGI IRIX/MIPS |
sgi |
* |
|
_SGI_SOURCE |
mips
host_mips |
| Cygwin Win/Intel-32 |
__CYGWIN32
WIN32 |
* |
|
* |
_X86_ |
Example C/C++ source code 1:
-
#ifdef sparc ... #endif #ifdef linux ... #endif #ifdef __CYGWIN32 ... #endif ... #if defined(linux) || defined(sparc) ... #endif ...
|
Example C/C++ source code 2:
-
#ifdef sgi return fn_sgi(); #elif defined(__CYGWIN32) return fn_win(); #elif defined(linux) return fn_linux(); #else struct time ts; return fn_time(); #endif ...
|
OR
|
#ifdef sgi #include file_sgi.h #elif defined(sparc) #include file_sparc.h #elif defined(linux) #include file_linux.h #else #error Unknown OS type #endif ...
|
Note use of the "#error" for error processing.
Also see YoLinux GNU Makefile cross platform tips
- Link error solution:
If you get a similar error ClassName::ClassName[not-in-charge]
The solution is to change the order of the libraries.
i.e. If the following
compile results in an error:
g++ source-file.cpp -lxxx -lyyy -lzzz -L../XXX -L../YYY -L../ZZZ
The solution is to change the order of the libraries:
g++ source-file.cpp -lyyy -lzzz -lxxx -L../XXX -L../YYY -L../ZZZ
The order of the library paths is irrellevant (-L).
- C++ Link error: "undefined reference to `vtable for classname-goes-here`"
My fix was to define a destructor. The virtual base class and destructor required the derived class to define a destructor.
- Architecture independent data types and pointers:
- Avoid 32/64 bit cross platform issues by using pointer type: intptr_t
Use include file stdint.h. MS/Windows uses INT_PTR.
- Avoid integer word size issues by using defined types in stdint.h
- Libraries are typically found in /usr/lib and /lib.
On systems which mix 32 and 64 bit libraries look for /usr/lib64 and /lib64.
- C++ References:
- C++ Library References:
- C++ API's and Toolkits:
- C++ Links and Info:
Books: |
-
|