QtCreator 프로젝트의 하위 디렉토리를 만드는 방법은 무엇입니까?
Qt 프로젝트가 꽤 커지고 있기 때문에 여러 디렉토리로 나누고 싶습니다. 그러나 QtCreator에서 찾아보기를 클릭하면 'Add directory'가 없으며 'Add new'에는 그런 것이 없습니다. 어떻게 든 할 수 있습니까?
사용할 수있는 한 가지 방법은 각 하위 디렉터리에 대한 프로젝트 포함 파일을 추가하는 것입니다.
Qt Creator는 GUI에 이러한 항목을 중첩 된 방식으로 표시하고 여기에 파일을 추가 할 수 있습니다.
예 :
project.pro에서
include(folder1/include.pri)
folder1 / include.pri에
HEADERS += MyClass.h
SOURCES += MyClass.cpp
기타
답변 : QtCreator에서 프로젝트의 폴더 또는 하위 디렉토리를 만드는 방법은 무엇입니까?
QT Creator 3.1.x 이전에는 프로젝트를 마우스 오른쪽 버튼으로 클릭 -> " 새로 추가 ... "하고 원하는 폴더의 경로를 변경할 수 있습니다.
폴더가 존재해야합니다. Qt가 생성하지 않습니다.
Qt는 .pro 파일의 경로를 처리합니다.
그게 다야!
같은 문제가 있었고 비교적 간단한 대답을 찾았습니다.
당신이 이동 할 필요 file.cpp
에은 newFolder
에 - 파일 (> 이름 바꾸기 오른쪽 클릭을)의 이름을 변경하는 것입니다 newFolder\file.cpp
.
Qt Creator는 .pro
파일을 새 폴더로 이동하고 자동으로 파일을 업데이트 합니다.
버전 1.2.90부터 Qt Creator는 필터 트리 옵션 만 트리 단순화로 설정되지 않은 경우 프로젝트의 폴더에있는 하위 폴더를 프로젝트 트리의 분기로 표시 합니다.
QT-CREATOR에서 하위 디렉터리를 만드는 것은 불가능한 것 같습니다.
다음을 시도하십시오.
- Create a number of sub-directories, with a file-explorer or by command line within the project-folder (for example net/, gui/, test/, data/ ...)!
- Move exisiting files into these new folders. And change their paths within the *.proj file!
- Create new also files from beginning within the new folders (By AddNew...)!
... QT-CREATOR displays only such folders which contain files that are written with their names into the *.pro or a *.pri file. At root level QT-CREATOR distinguishes between HEADERS, SOURCES, FORMS and OTHER FILES. Within these root folders you can find project-own subfolders, repeatedly. (Not covered in this text is splitting into sub-projects.)
You can create a sub-directory as long as you have a file you wish to create in it. Go to the parent directory, and "Add" a file to it. "Browse" for the location and create a new folder inside the browse window. Agreed, that is not quite intuitive.
When you create a new Class in your Qt-Project, you can choose the path in this wizard and hereby specify new folders like DAL, BO, UI, ...
When my 'data' directory only had one sub-directory 'model' it just appeared as "data/model". After adding 'dao' as another sub-directory it displayed data with the traditional +/- manner to reveal model and dao.
Here's what I have done:
In the Project Folder (outside the IDE), create Directories that you'd like to put your code in and move your source files into those directories.
- "foo"디렉토리에 "foo.cpp"와 "foo.h"를 넣으십시오.
"* .pro"파일에서 이동 한 소스 파일을 참조하는 각 줄로 이동하여 디렉토리 이름을 추가 한 다음 소스 파일 이름 앞에 '/'를 추가합니다.
.pro 2 단계 이전 :
SOURCES += main.cpp \
foo.cpp
HEADERS += \
foo.h \
.pro 2 단계 이후
SOURCES += main.cpp \
foo/foo.cpp
HEADERS += \
foo/foo.h
- 테스트 할 프로젝트를 다시 빌드하십시오.
참고 URL : https://stackoverflow.com/questions/1176666/how-to-create-a-subdirectory-for-a-project-qtcreator
'developer tip' 카테고리의 다른 글
PendingIntent에서 사용되는“requestCode”는 무엇입니까? (0) | 2020.08.24 |
---|---|
Android N Java 8 기능 (Jack 컴파일러) 및 Kotlin interop (0) | 2020.08.24 |
인스턴스 메서드의 Python 데코레이터가 클래스에 액세스 할 수 있습니까? (0) | 2020.08.24 |
Jenkins 작업 설명의 HTML (0) | 2020.08.23 |
Java 표준 "둘 다 null 또는 같음"정적 메서드가 있습니까? (0) | 2020.08.23 |