編譯包含標頭檔案,連結新增庫,同一專案在不同平臺的配置.
阿新 • • 發佈:2020-08-27
ChartDirector 6.0 (C++ Edition)
Installation
Installing ChartDirector for C++
ChartDirector for C++ is released as a zip file on Windows, and as a tar.gz file on Linux, FreeBSD, Mac OS X and Solaris. To install ChartDirector for C++:, simply extract the files from distribution.- On Windows, you may use Winzip or similar tools to unzip the ChartDirector
distribution.
- On Linux, FreeBSD, Mac OS X and Solaris, you may use:
gunzip [chartdir_file_name].tar.gz tar xvf [chartdir_file_name].tar
Running ChartDirector Sample Programs
ChartDirector for C++ comes with three sets of sample programs.- Command line sample programs are included in the "ChartDirector/cppdemo"
subdirectory. They are compatible with any standard C++ compiler and work on all
supported operating systems.
On the Windows edition of ChartDirector, Visual Studio project files are included. On the Linux, FreeBSD, Mac OS X and Solaris editions of ChartDirector, make files are included. Note that the make files assume the C++ compiler is "g++". You may need to modify the make files if you are using a different compiler.
- On the Windows edition of ChartDirector, MFC based sample programs with
Visual Studio project files are included in the "ChartDirector\mfcdemo"
subdirectory.
- QT based sample programs with QT ".pro" project files are included in the
"ChartDirector/qtdemo" subdirectory. Please refer to Using ChartDirector with Qt for more information
on how to compile these sample programs.
Using ChartDirector in Your Projects on Windows
When you develop a project using ChartDirector, the development environment should be configured appropriately so that it can find the proper header files and link to the proper library files.- Compilation
All C++ modules that use ChartDirector need to include the file "chartdir.h". The "chartdir.h" will in turn include more header files. All these files are located in the "ChartDirector\include" subdirectory. The development environment header file search path must be configured to include that directory.
- For Visual Studio, the steps are: Select "Project/Properties" from the menu
bar, go to "C/C++" -> "General", in the "Additional Include Directories"
field, add the path for the "ChartDirector\include" subdirectory.
- For QT Creator or qmake, you may edit the QT project file and add the
line:
INCLUDEPATH += [Path_Of_ChartDirector_Include_Subdirectory]
- For Visual Studio, the steps are: Select "Project/Properties" from the menu
bar, go to "C/C++" -> "General", in the "Additional Include Directories"
field, add the path for the "ChartDirector\include" subdirectory.
- Linking
After compilation, the object file needs to link with "ChartDirector\lib\chartdir60.lib".
- For Visual Studio, the steps are: Select "Project/Properties" from the menu
bar, go to "Linker" -> "Input", in the "Additional Dependencies" field, add
the path of the file "chartdir60.lib".
- For QT Creator or qmake, you may edit the QT project file and add the
line:
LIBS += [Path_Of_chardir60.lib]
- For Visual Studio, the steps are: Select "Project/Properties" from the menu
bar, go to "Linker" -> "Input", in the "Additional Dependencies" field, add
the path of the file "chartdir60.lib".
- Execution
During execution, the executable would need to find the "chartdir60.dll". You may copy the "chartdir60.dll" to the same directory where the executable runs, or you may copy it to a directory in the operating system search path (eg. [system32]).
Using ChartDirector in Your Projects on Linux, FreeBSD, Mac OSX and Solaris
When you develop a project using ChartDirector, the development environment should be configured appropriately so that it can find the proper header files and link to the proper library files.- Compilation
All C++ modules that use ChartDirector need to include the file "chartdir.h". The "chartdir.h" will in turn include more header files. All these files are located in the "ChartDirector/include" subdirectory. The compiler must be configured to include that directory in its header file search path. This can be achieved by using the following compiler flag:
-I[Path_Of_ChartDirector_Include_Subdirectory]
If you are using QT, you may edit the QT project file and add the line:
INCLUDEPATH += [Path_Of_ChartDirector_Include_Subdirectory]
- Linking
After compilation, the object file needs to link with "libchartdir.so" (for Linux, FreeBSD and Solaris) or "libchartdir.dylib" (for Mac OS X). This can be achieved by using the following linker flag:
-L[Path_Of_ChartDirector_Lib_Subdirectory] -lchartdir
If you are using QT, you may edit the QT project file and add the line:
LIBS += -L[Path_Of_ChartDirector_Lib_Subdirectory] -lchartdir
- Execution
The ChartDirector shared object and other dependent files are in the "ChartDirector/lib" subdirectory. To ensure the runtime linker can locate ChartDirector, you may copy *everything* (recursive copy) in "ChartDirector/lib" (including the fonts subdirectory for Linux, FreeBSD and Solaris editions of ChartDirector) to "/usr/lib". This is by first changing to the "ChartDirector" directory, then use:
cp -R lib/* /usr/lib
You may also put the "ChartDirector/lib" files in other locations if you build the executable properly. For example, on Linux, FreeBSD and Solaris, you may use the -R linker flag to specify additional paths to search for shared objects. On Mac OS X, you may use the install_name_tool to specify alternative locations for shared objects. Please refer to the documentation of your development tools for details.
- An alternative method is to hard code the license key into the source code
by using the Chart::setLicenseCode API.
This method is recommended if your are redistributing ChartDirector, because
your customer will then be unable to see the license key (unless your software
is open source).