更改obj文件的构建路径

问题描述

我最近按照tutorial下载了vs代码的C / C ++扩展,将其设置为Windows。我设法弄清楚了如何更改可执行文件的构建路径,但无法弄清楚.objvc140.pdb文件的构建路径。

这是我构建并运行程序后要使用的目录结构:

directory

现在.objvc140.pdb文件最终出现在目录的根目录中,但是我想将它们放在obj文件夹下,如上所示。

这是我当前的tasks.json文件

{
 "version": "2.0.0","tasks": [
    {
        "type": "shell","label": "C/C++: cl.exe build active file","command": "cl.exe","args": [
            "/Zi","/EHsc","/Fe:","${workspaceFolder}\\bin\\debug\\${fileBasenameNoExtension}.exe","${file}"
        ],"options": {
            "cwd": "${workspaceFolder}"
        },"problemmatcher": [
            "$msCompile"
        ],"group": {
            "kind": "build","isDefault": true
        }
     }
  ]
}

解决方法

经过command line arguments for the msvc compiler

后,我找到了解决问题的方法

我必须添加一个/Fd和一个/Fo参数来正确配置byte BCD2DEC(byte val){ //Ex: 51 = 01010001 BCD. 01010001/16-->0101=5 then x10-->50. return(((val/16)*10)+(val%16));} // 01010001%16-->0001. 50+0001 = 51 DEC void GetRTCTime(byte *second,byte *minute,byte *hour,byte *DoW,byte *Date,byte *month,byte *year){ Wire.beginTransmission(DS3231_I2C_Addr); //Open I2C to RTC Wire.write(0x00); //Set reg pointer to 0x00 Hex Wire.endTransmission(); //End xmit to I2C. Tell RTC to send data. Wire.requestFrom(DS3231_I2C_Addr,7); //Get 7 bytes from RTC buffer *second = BCD2DEC(Wire.read() & 0x7f); //Seconds. remove hi order bit *minute = BCD2DEC(Wire.read()); //Minutes *hour = BCD2DEC(Wire.read() & 0x3f); //Hour 0-24 remove 2 hi order bits *DoW = BCD2DEC(Wire.read()); //Day of week (1Sun-7Sat) *Date = BCD2DEC(Wire.read()); //Date (1-31) *month = BCD2DEC(Wire.read()); //Month (1-12) *year = BCD2DEC(Wire.read()); //Year (00-99) } void printTime(){ //Read & print data from RTC GetRTCTime(&second,&minute,&hour,&DoW,&Date,&month,&year); //Get RTC data Serial.print(x); //Print year 20xx. Year 00-99 if(month<10){Serial.print("0");} //Print leading 0 if needed Serial.print(month,DEC); //Month as decimal if(Date<10){Serial.print("0");} //Print leading 0 if needed Serial.print(Date,DEC); //Date (1-30) Serial.print(DoWList[DoW]); //1Sun-7Sat (0=null) if(hour<10){Serial.print("0");} //Print leading 0 if needed Serial.print(hour,DEC); //HH if(minute<10){Serial.print("0");} //Print leading 0 if needed Serial.print(minute,DEC); //MM if(second<10){Serial.print("0");} //Print leading 0 if needed Serial.println(second,DEC); //SS } pdb文件的构建路径。

如果有人对obj感兴趣,则为:

tasks.json