Project Source Code Directory Structure Suggestions [Original]

xiaoxiao2021-03-06  73

Project Source Code Directory Structure Suggestions

In order to facilitate the management of source code, improve the efficiency of the source code module synthesis, avoid waste of unnecessary time, make the following recommendations for the project directory:

Note: This suggestion applies to multiple DLLs

Project solution

the whole frame

The overall directory structure should be the following look (with digital camera items (DVR) as

Column):

IWISE_DVR --------- Build

|

| ------- Document

|

-------- bin ------- Debug

| | |

| ----- RELEASE

|

-------- LIB ------- Debug

| | |

| ----- RELEASE

|

| ------- Include --- Projecta

| | |

| | | --Projectb

| | |

| | - --Projectc

|

------- Projecta

|

|

------- Projectb

|

|

------- Projectc

Note:

Projecta

,

Projecb

,

Projectc

The name of the real project should be

Build directory structure

Build is a place where the intermediate file generated when the VC compile.

Build ------- Projecta -------- Debug

| | |

| ---- Release

----- Projectb -------- Debug

| | |

| ---- Release

----- Projectc -------- Debug

|

---- RELEASE

For example, when new Projecta is created, the output directory and the intermediate directory should be set to ../build/projecta/debug and set the release version to the project -> Project Properties -> General tab..

. ../build/projecta/release

Bin directory

Bin

Directory storage program executable, including all modules output

DLL

file

Due to two versions of general procedures

Debug

with

RELEASE

therefore

Bin

There is this inside.

Two directories.

BIN ------------ Debug

|

------ RELEASE

For example, when new Projecta is created, the output file should be set to ../bin/debug/$(ProjectName ).exe in the item-> project properties -> linker -> General tab, set the Release version to. ./bin/release/$ (ProjectName ).exe

Include directory

The include directory stores the head (.h) file exported by each item.

INCLUDE -------- Projecta

|

----- Projectb

|

----- Projectc

For example: Items need to use the project A (Projecta) header file should be in the item-> project properties -> c / c -> regular -> additional included directory added ../include/projecta

In addition, the export header file of the project A should not appear in both (above) (above) in the entire iWise-DVR directory, that is, the project A also needs to use the header file in the directory of the ../include/projecta, then set up the above method

Set the included directory.

*********************************************************** ************************************************

************************************************************

************************************************************

************************************************************

************************************************************

IWISE DVR Policy Module Summary: (vs2003.net)

1. Create a work space to create a directory structure

BinbuilddocincludelibProjectaprojectBProjectTestAProjectTestb

2. Create a sub-project module: Select "MFC Extension DLL" of "MFC DLL"

3. ADO is required in DLL, in Dllmain

DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH,

DLL_THREAD_ATTACH, DLL_THREAD_DETACH

Branch joins:

IF (Failed (:: Coinitialize (NULL)) {AFXMessageBox ("com in load"); return 0;}

with

:: Couninitialize ();

3.1 Close the project, copy the header file to the corresponding directory.

3.2 Open the engineering property, select "General" of "Configuration Properties", output directory, and intermediate directory to change to the following format:

. ../build/stragetyProject/debug

3.3 "General" "Additional Included Directory" on the "C / C " page, fill in the following format:

. ./Include/stragetyproject

Add header files to projects - "Add existing item"

3.4 Preprocessor definition, add "_VIDEORECORD_STRATEGY_EXT"

3.5 Connecting "Regular" "Output File" is changed to the following format:

../ bin / debug / strategy.dll (Description: If you modify the default DLL file name here, you need to modify the DEF file)

3.6 Advanced import libraries of the connector are changed to the following format: ../ LIB / Debug / Strategy.lib

4. Add classes or existing files in child projects

#ifdef _VIDEORECORD_STRATEGY_EXT #define VIDEORECORD_STRATEGY_API __declspec (dllexport) #else #define VIDEORECORD_STRATEGY_API __declspec (dllimport) #endif / **************************** *********************** * contains header files ******************** ****************************** / Class CVIDEORECORDSTRIPRIVATE; / / Agent implementation class / ********** ***************************************** * class definition ***** ****************************************************** /

Class video_strategy_api cvideorecordStrategy

{

...;

}

Definition _VIDEORECORD_STRATEGY_EXT

// Not recommended: Class Export: AFX_EXT_CLASS5. Talk above is the debug version, release settings.

6. Test procedure or main program application

6.1 "Configuration Properties" "Output Directory" and "Intermediate Directory" in "General"

. ../Build/testproject/debug

6.2 "Configuration Properties" "Work Directory" of "Debug" is changed to:

. ../Bin/debug

6.3 "C / C " "Conventional" "Additional Included Directory" is changed to the following format:

. ./Include/stragetyproject

6.4 Connect "Regular" "Output File" is changed to:

. ../bin/debug/$ (Projectname ).exe

6.5 Connectors "General" attached library directory is changed to: ../ LIB

6.6 The "Additional Dependencies" of the connector "Input" is as follows: TEST1.LIB multiple files separated by spaces,

When there is a space in a file name, each file is quoted and the number is used.

6.7 Setting up the project's dependencies

6.8 Setting up the startup project

7. Example, add a function to the test DLL:

INT TEST_CLASS :: Test_foo (void) {:: MessageBox (NULL, "AAA", "AABB", MB_OK); RETURN 0;} Test programs or main programs

#include "dll_class.h"

Test_class_test;

_Test.test_foo ();

2004-11-01 18:03 Shenzhen

转载请注明原文地址:https://www.9cbs.com/read-93046.html

New Post(0)