首先说明vue-cli中assets和static两个文件的区别 1.assets在项目编译的过程中会被webpack处理理解为模块依赖,如果执行npm run dev或npm run build命令行,assets会被编译,导致路径发生变化,所以如果写成绝对路径,会存在问题 2.static在项目编译的过程中webpack不会被解析,他相当于是存放第三方文件的地方,路径可写成绝对路径 总结:assets中的文件路径会变,static中的文件路径不变 解决办法: 1.将图片放到static文件中…
下面提供一个比较完整的示例程序,一共有四个文件:main.cpp.test.c.test.h.test.hpp main.cpp #include "test.hpp" int main() { fun(); //相当于在公共命名空间 ; } test.hpp #ifndef _TEST_HPP_ #define _TEST_HPP_ #ifndef __cplusplus #error Do not include the hpp header in a c project! #en…