VS的使用
配置一个工程
问题描述:
要运行一个源码工程,工程中含有层级目录,.cpp与.h在多级目录中混合存储。并且该工程的运行依赖一些静态库(.lib)与动态库(.dll)。
建立:
- 把.h拷贝至$(ProjectDir)\include下,可以在search栏下用.h来搜索层级目录下所有*.h;
- 把*.cpp拷贝至$(ProjectDir)\src下;
- 第三方库拷贝至thirdparty目录下,并且分”include”、“lib”、(src)二级目录;
- VS下右击solution->add->existing item将所有.cpp、.h文件添加到工程中;
- Solution->property->configuration properties->C++->general->additional include directories->\((ProjectDir)\include;\)(ProjectDir)\thirdparty\include;
- Solution->property->configuration properties->linker->general-> additional include directories ->$(ProjectDir)\thirdparty\lib ->linker->input->additional dependencies: the name of lib
- Set output path: Solution->property->configuration properties->general -> output directory : .\bin
error 1:
include iostream: skipped when looking for precompiled header use
Solution: #include “stdafx.h”在文件的最上方
快捷键
F10 //next
F11 //step into
Shift F11 //step out
F5 //run to next break point
F9 //set break point