首页 > 解决方案 > 如何使用 Qt 和 CMake 编译 ac 文件?

问题描述

使用Qt5.15.1和 cmake。

从 qtCreator 生成的一个新的空白 qml 项目开始。我需要添加 ac 文件。

在 CMakeLists.txt 中,我添加了这样的文件:

  add_executable(untitled1
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    c_file.c
  )

如果我进行完整构建,这是日志文件:

[ 20%] Automatic MOC and UIC for target untitled1
[ 20%] Built target untitled1_autogen
Scanning dependencies of target untitled1
[ 40%] Building CXX object CMakeFiles/untitled1.dir/untitled1_autogen/mocs_compilation.cpp.obj
[ 60%] Building CXX object CMakeFiles/untitled1.dir/main.cpp.obj
[ 80%] Building CXX object CMakeFiles/untitled1.dir/mainwindow.cpp.obj
[100%] Linking CXX executable untitled1.exe
[100%] Built target untitled1

可以看到,c 文件没有被编译。我应该怎么办?

标签: qtcmake

解决方案


推荐阅读