iPhone Helpful Coding Tips

本文分享了iOS开发中的一些实用技巧,包括条件编译、美化启动画面、批量复制图片、平台库组合、图标生成、对象日志输出、过渡时间设置、一次性操作等。文章还涉及了Interface Builder图像分辨率调整、屏幕分辨率检测、获取可用内存、文件复制到文档目录、安全边界处理、防止XCode优化PNG文件、撤销意外的Tab栏标签、自定义旋转逻辑、选择器调用、避免旋转问题、使用前端和后端框架等核心内容。

http://umlautllama.com/w2/?action=view&page=iPhone%20Helpful%20Coding%20Tips


1. Conditional build for simulator

Sometimes, you have some code you only want to run in the Simulator. the TARGETIPHONESIMULATOR define will help you with this:

#if TARGET_IPHONE_SIMULATOR
NSLog( @"Running in the simulator!" );
#else
NSLog( @"Running on the device!" );
#endif

NSLog calls from the simulator will result in text being visible via the Console.app Be sure to set a search on your app name to minimize the "noise" in the view window.

NSLog calls from the device will be visible via the Organizer, accessible via XCode.


TOP

2. Make your default.png (splash) transition to your app nicely

Make your default.png nicely transition to your main screen. (Great for splash pages, or credits, or just to add another bit of polish to your app...)

in your app delegate.m:

- (void)doDefaultPngFade {
    // add the new image to fade out
    UIImageView * defaultFadeImage;
    defaultFadeImage = [[[UIImageView alloc] 
                                   initWithImage:[UIImage
                                   imageNamed:@"Default.png"]autorelease]];
[self.mainViewController.view addSubview:defaultFadeImage];


    // and start the default fadeout
    [UIView beginAnimations:@"InitialFadeIn" context:nil];
    [UIView setAnimationDelegate:defaultFadeImage];
    [UIView setAnimationDidStopSelector:@selector( removeFromSuperview )];
    [UIView setAnimationDelay:0.0]; // stay on this long extra
    [UIView setAnimationDuration:0.30]; // transition speed
    [defaultFadeImage setAlpha:0.0];
    [UIView commitAnimations];
}

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    // do initialization stuff here
    // ...
    [self doDefaultPngFade];
}

TOP

3. copying in a bunch of images...

If you've worked with the simulator and need to have a large image set installed, create a project, drop in all of the images, and then call this code. It will copy all images in the base of the app bundle into your device/simulator library

// copyImagesToLibrary - copies all valid images in the app bundle into your simulator/device library
- (void) copyImagesToLibrary
{
    NSArray * fileList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[NSBundle mainBundle].bundlePath error:nil];
    for(NSString * fn in fileList) {
        UIImage * img = [UIImage imageNamed:fn];
        if( img ) UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
    }
}

TOP

4. combining platform libs for easy linking

This will take two platforms' architecture's static libraries, and mash 'em together to make them easier to link against for the simulator and the device

cp ../build/Debug-iphoneos/libFooBar.a ./libFooBarARM.a
cp ../build/Debug-iphonesimulator/libFooBar.a ./libFooBarSIM.a
lipo libFooBarARM.a libFooBarSIM.a -create -output libFooBar.a

TOP

5. Icon for AdHoc distributions, .IPA Generation

NOTE: This is obsolete with the [REDACTED] beta toolset.

Make a zip file with a renamed extension called "yourapp.ipa"

  • iTunesArtwork (512x512 JPG with no .jpg)
  • Payload/
    • yourapp.app

Or, to automate this;

cp assets/MyIcon_512x512.jpg iTunesArtwork
mkdir Payload
cp -rp build/myApp.app Payload/
zip -r myApp.zip iTunesArtwork Payload
mv myApp.zip myApp.ipa

Note: it does not seem to be necessary that the ZIP/IPA filename have anything to do with the real app name at all. You can name it "IEnjoyCheese.ipa" and iTunes will still get the app's display name from within the bundle appropriately.

An example Makefile showing this is also available.


TOP

6. Have your object respond to %@

If you like to use NSLog() for debugging, the best way to have your custom objects output text is via overriding the NSObject "description" method. Then you can do something like:

NSLog( @"My Object info:%@", myObject );

Just implement this in your object's class:

- (NSString *) description;

TOP

7. Transition times

If you want to get your animation moving at the same rate/duration as an AppleOS transition, start at 0.3 seconds. That's the duration that most of their transitions run for.


TOP

8. Do something one time

Sometimes, you only want to set up things (like default settings) the first time an app is run. Here's a little bit of code you can call in your AppDelegate;

#define THIS_APP_VERSION (42)
NSUserDefaults *sd = [NSUserDefaults standardUserDefaults];
int defaultsVersion = [sd integerForKey:@"This App Version"];
if( defaultsVersion != THIS_APP_VERSION )
{
    [sd setBool:NO forKey:@"Bool Value 1"];
    [sd setInteger:37 forKey:@"PlayMode"];
    [sd setInteger:THIS_APP_VERSION forKey:@"This App Version"];
}

TOP

9. Interface Builder image resolution

Interface Builder expects image assets to be at 72dpi, even though the iPhone's screen is not 72dpi. If you have images that are 160 or whatever dpi, you will need to convert them. You can either do this in Photoshop/Pixelmator by loading in each one, adjusting, saving it, or by using the ImageMagick tools with a command line similar to this:

convert -units PixelsPerInch -density 72x72 original.png fixed.png

or simply:

mogrify -units PixelsPerInch -density 72x72 theImage.png

TOP

10. Set the default Organization Name for newly created XCode files

defaults write com.apple.xcode PBXCustomTemplateMacroDefinitions '{ ORGANIZATIONNAME = "Your Company Name"; }'

TOP

11. Set the default com.yourcompany for XCode projects

First of all, head over to

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application

In here, you'll find the templates for all of the XCode projects. All of the .plist files are plain ascii (non-binary) plists.

First thing to do is to make a folder in: (home)/Library/Application Support/Developer/Shared/Xcode/Project Templates

And copy the templates over to this location. Edit them here, rather than the systemwide ones. Do note however that when you upgrade your SDK and tools, that the tool-provided templates might have been updated, and that would be a good time to update these template copies as well.

Once they're copied over, edit them in this new location:

vi */*plist

And then just replace 'yourcompany' with 'umlautllama' in my case.

<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>

to CFBundleIdentifier com.umlautllama.${PRODUCT_NAME:identifier}

Alternatively, you can change it to:

<key>CFBundleIdentifier</key>
<string>__DOTCOMNAME__.${PRODUCT_NAME:identifier}</string>

then

defaults write com.apple.xcode PBXCustomTemplateMacroDefinitions '{ DOTCOMNAME = "com.mycompany"; }'

It really doesn't matter which; in either case, you're changing all of the templates on your machine for your projects, so making it easily extensible with the defaults-settings is kinda pointless... so you might as well just set it in the .plist files and not bother with the second method.


TOP

12. Add a system volume slider to your IB views

  1. Create a new UIView, place it in your View
  2. Change the class of this UIView to: MPVolumeView
  3. Add "MediaPlayer.framework" to your project

TOP

13. Identify iPhone/Touch models

This code is borrowed from this blog post.

#include <sys/types.h>
#include <sys/sysctl.h>

- (NSString *)deviceModel
{
    NSString *deviceModel = nil;
    char buffer[32];
    size_t length = sizeof(buffer);
    if (sysctlbyname("hw.machine", &buffer, &length, NULL, 0) == 0) {
        deviceModel = [[NSString alloc] initWithCString:buffer encoding:NSASCIIStringEncoding];
    }
    return [deviceModel autorelease];
}

Possible response handler

- (NSString *) platformString{
    NSString *platform = [self platform];
    if ([platform isEqualToString:@"i386"]) return @"Simulator";

    if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
    if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G (China, no WiFi possibly)";

    if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";

    if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4 )";
    if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4 (CDMA/Verizon)";

    if ([platform isEqualToString:@"iPod1,1"])   return @"iPod Touch 1G";
    if ([platform isEqualToString:@"iPod2,1"])   return @"iPod Touch 2G";
    if ([platform isEqualToString:@"iPod2,2"])   return @"iPod Touch 2.5G";
    if ([platform isEqualToString:@"iPod3,1"])   return @"iPod Touch 3G";
    if ([platform isEqualToString:@"iPod4,1"])   return @"iPod Touch 4G";

    if ([platform isEqualToString:@"iPad1,1"])   return @"iPad 1G (wifi)";
    if ([platform isEqualToString:@"iPad1,2"])   return @"iPad 1G (3G/GSM)";
    if ([platform isEqualToString:@"iPad2,1"])   return @"iPad 2G (wifi)";
    if ([platform isEqualToString:@"iPad2,2"])   return @"iPad 2G (GSM)";
    if ([platform isEqualToString:@"iPad2,3"])   return @"iPad 2G (CDMA)";

    if ([platform isEqualToString:@"AppleTV2,1"])   return @"Apple TV 2G";

    if ([platform isEqualToString:@"i386"])      return @"iPhone Simulator";

    return platform;
}

Here's another implementation from [http://www.clintharris.net/2009/iphone-model-via-sysctlbyname/]

- (NSString *) platform  
{  
    size_t size;  
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);  
    char *machine = malloc(size);  
    sysctlbyname("hw.machine", machine, &size, NULL, 0);  
    NSString *platform = [NSString stringWithCString:machine];  
    free(machine);  
    return platform;  
}  

--

TOP

14. Is the screen being double-sized?

Check the scale value! [http://www.markj.net/]

+(BOOL) screenIs2xResolution {
  return 2.0 == [MyDeviceClass mainScreenScale];
}

+(CGFloat) mainScreenScale {
  CGFloat scale = 1.0;
  UIScreen* screen = [UIScreen mainScreen];
  if ([UIScreen instancesRespondToSelector:@selector(scale)]) {
    scale = [screen scale];
   }
  return scale;
}

On iOS 3.2, the best we can do is:

+(BOOL) isIPad {
  BOOL isIPad=NO;
  NSString* model = [UIDevice currentDevice].model;
  if ([model rangeOfString:@"iPad"].location != NSNotFound) {
    return YES;
  }
  return isIPad;
}

TOP

15. Amount of free memory available

#import <mach/mach.h> 
#import <mach/mach_host.h>

static natural_t get_free_memory () {
    mach_port_t host_port;
    mach_msg_type_number_t host_size;
    vm_size_t pagesize;

    host_port = mach_host_self();
    host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
    host_page_size(host_port, &pagesize);        

    vm_statistics_data_t vm_stat;

    if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {
        NSLog(@"Failed to fetch vm statistics");
        return 0;
    }

    /* Stats in bytes */ 
    natural_t mem_free = vm_stat.free_count * pagesize;
    return mem_free;
}

TOP

16. Copy a file from your app bundle to Documents

You may want to include files with your bundle that get copied into your documents folder in the sandbox. The following code is adapted from the Apple "SQLiteBooks" example:

- (void)makeDocumentSubdir:(NSString *)subdirname
{
    // First, test for existence.
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];

    // set up the basic directory path name
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    // create the directory path name for the subdirectory
    NSString *subdirectory = [paths objectAtIndex:0];
    subdirectory = [documentsDirectory stringByAppendingPathComponent:subdirname];
    success = [fileManager createDirectoryAtPath:subdirectory withIntermediateDirectories:YES attributes:nil error:NULL ];
}

- (void)copyFileNamed:(NSString *)filename intoDocumentsSubfolder:(NSString *)dirname
{
    // First, test for existence.
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    // set up the basic directory path name
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    // set up the directory path name for the subdirectory
    NSString *subdirectory = [documentsDirectory stringByAppendingPathComponent:dirname];

    // set up the full path for the destination file
    NSString *writableFilePath = [subdirectory stringByAppendingPathComponent:filename];
    success = [fileManager fileExistsAtPath:writableFilePath];

    // if the file is already there, just return
    if (success)
            return;
    // The file not exist, so copy it to the documents flder.
    NSString *defaultFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:filename];
    success = [fileManager copyItemAtPath:defaultFilePath toPath:writableFilePath error:&error];
    if (!success) {
            //[self alert:@"Failed to copy resource file"];
            NSAssert1(0, @"Failed to copy file to documents with message '%@'.", [error localizedDescription]);
    }
}


- (void)firstRunSetup
{
    [self makeDocumentSubdir:@"FileDir1"];
    [self copyFileNamed:@"FirstFile.sqlite" intoDocumentsSubfolder:@"FileDir1"];
    [self copyFileNamed:@"SecondFile.sqlite" intoDocumentsSubfolder:@"FileDir1"];
}

TOP

17. Safe MIN/MAX

To prevent issues with extra increments and decrements with code like:

#define MAX(A,B)   (((A)<(B))?(A):(B))
int x = MAX( a++, --y );

Define it like this instead:

#define MAX(A,B)   
 ({ 
    __typeof__(A) __a = (A); 
    __typeof__(B) __b = (B); 
    __a < __b ? __b : __a; 
 })

TOP

18. Prevent XCode from messing with your PNGs

As you might have found out by now, XCode likes to "optimize" your PNG files when it builds your application bundle. Many of you probably also realize that "optimize" means "hack it into a format that prevents it from working as you'd expect it to in GL". Here's a fix to prevent it from doing this to your precious PNGs.

On the image file, right-click, and 'get info'. Change the file type from "image.png" to "image".


TOP

19. Revert accidental tab badging in XIBs

If you set the badge value on a tab in Interface Builder, you will notice that you can't clear/remove the badge from the tab anymore. If you clear out the text input box, you will notice that the badge just displays as an empty red circle. One way to eliminate it obviously is in code: (for example)

[[[[[self tabBarController] tabBar] items] objectAtIndex:2] setBadgeValue:nil];

But if it was unintentional, and you want to remove it in the XIB itself, you don't need to delete the tab and start over with it. Just save out the file, and load the .XIB file in your favorite text editor. Look for an XML tag like this:

<string key="IBUIBadgeValue"/>

Remove this item, save it out, and when you return to Interface Builder, it will ask you to revert to the saved version, accept, and the badge will be gone!


TOP

20. Do your own rotation thing...

To do something other than autorotate... (or to manually rotate)

first, subscribe to rotation notifications, and make sure they occur.

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
[[NSNotificationCenter defaultCenter] addObserver:self                                            
                                         selector:@selector(didRotate:)
                                             name:UIDeviceOrientationDidChangeNotification
                                           object:nil];

also, catch them here...

- (void) didRotate:(NSNotification *)notification
{   
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

    if (orientation == UIDeviceOrientationLandscapeLeft)
    {
        // manually set the status bar orientation so status bar, alerts and keyboard work
        [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft];
    }
}

And turn off autorotations...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation 
{
    // return NO - stay in the default orientation
    //  - also, you could just omit this method entirely.
    return NO;
}

Finally, set the default orientation in your app's Info.plist file:

Key: UIInterfaceOrientation
Val: UIInterfaceOrientationLandscapeRight  (or the appropriate value for your app)

TOP

21. Defining a selector to later call

In your class definition:

id theObject;
SEL theSelector;

To call it at runtime:

[theObject performSelector:theSelector];

TOP

22. More...


源码直接下载地址: https://pan.quark.cn/s/95437fdf229e Intel I-219V网卡驱动是一款专门为Intel的I-219V千兆以太网控制器而研发的驱动程序,其主要作用在于保障在Ubuntu 16.04操作系统环境下的正常运作以及优化系统性能。Intel I-219V作为一款广泛应用的内置网络接口控制器(NIC),常被集成在台式机及笔记本电脑的主板上,负责提供高速的网络连接服务。Intel公司所提供的e1000e驱动是与此硬件相配套的开源驱动解决方案,其中版本3.3.5.3是专门针对该硬件设备的定制版本。此驱动包含了不可或缺的源代码部分,赋予开发者和系统管理者按照特定需求进行编译和定制的权限,从而能够适应多样化的系统配置或针对特定情形进行问题解决。源代码的可用性同样表明用户有能力依据Linux内核的更新情况来升级驱动,确保与最新技术标准的兼容性。在Ubuntu 16.04系统中成功编译的驱动意味着它已经通过了严苛的测试流程,并能够与该版本的Linux内核实现良好兼容。Ubuntu 16.04,其代号为Xenial Xerus,是一个长期支持(LTS)的版本,因此对于那些追求系统稳定性和安全保障的用户群体而言具有特殊的意义。驱动程序的兼容性保障了I-219V网卡能够在该系统平台上实现无缝运行,提供稳定可靠的网络连接,这既包括局域网(LAN)的连接,也可能涵盖通过Wi-Fi桥接实现的无线网络连接。驱动程序的核心职责涵盖了网络接口的初始化与管理、数据包的接收与发送处理,以及错误检测与纠正功能的执行。在Linux操作系统架构中,驱动通常以模块的形式加载至内核之中,这种设计允许在非必要时期进行卸载操作,以此来有效节省系统资源。e1000e驱...
内容概要:本文围绕基于共识的捆绑算法(CBBA)在多智能体系统中的多任务分配问题展开研究,重点应用于远程太空船交会与维修的相对轨道操作(RPO)规划。通过Matlab代码实现了CBBA算法,系统地解决了多个航天器在复杂空间环境下协同执行多目标任务时的任务分配、路径规划与动态协商问题。研究详细展示了算法在任务分解、竞标机制、共识达成及冲突消解等方面的核心逻辑,验证了其在分布式决策、通信受限条件下的高效性与鲁棒性,并结合航天工程实际背景突出了算法的应用价值。该资源不仅提供完整的仿真代码,还包含详细的流程解析,有助于深入理解多智能体协同机制的设计原理。; 适合人群:具备控制理论、航天器动力学、多智能体系统或分布式优化背景的研究生、科研人员及航空航天领域工程技术人员,熟练掌握Matlab编程者尤佳。; 使用场景及目标:①应用于在轨服务、空间碎片清除、多航天器编队飞行、星座维护等多智能体协同任务的任务分配与规划;②为研究人员提供CBBA算法的实现范例,支撑其开展分布式任务规划算法的改进与扩展研究;③作为教学案例用于高级课程中讲解多智能体协同决策机制。; 阅读建议:建议结合Matlab代码逐模块分析算法实现过程,重点关注任务打包、竞标更新、共识收敛等关键环节,可尝试引入通信延迟、故障容错或障碍规避机制以进一步提升算法实用性。
内容概要:本文介绍了一种基于关键场景辨别算法的两阶段鲁棒微网优化调度方法,旨在有效应对风电等可再生能源出力不确定性带来的调度挑战。通过Matlab代码实现,构建了包含预调度与实时调整的两阶段鲁棒优化模型,第一阶段制定初始调度计划以应对不确定性,第二阶段根据实际运行数据进行修正,从而提升微网运行的经济性与可靠性。该方法结合场景生成与缩减技术,识别关键不确定性场景,降低计算复杂度,同时增强了调度方案的鲁棒性。文中还探讨了该方法与智能优化算法、机器学习及电力系统仿真工具的集成应用,展现了其在复杂综合能源系统中的广阔应用前景。; 适合人群:具备一定电力系统基础知识和Matlab编程能力,从事新能源、微网优化、不确定性建模与鲁棒调度等领域研究的科研人员、工程技术人员及研究生。; 使用场景及目标:①应用于高比例可再生能源接入的微电网优化调度,提高系统对源荷不确定性的适应能力与运行稳定性;②为科研人员提供可复现的两阶段鲁棒优化建模与求解范例,支撑高水平学术论文的复现、算法改进与创新研究。; 阅读建议:建议结合提供的Matlab代码与网盘资料,动手实践关键场景生成、不确定性建模、两阶段优化建模与求解全过程,重点关注鲁棒优化框架的设计逻辑与关键场景辨别的实现机制,同时参考文中提及的多种算法与工具,拓展研究思路与应用场景。
内容概要:本文系统阐述了基于二阶锥松弛(SOCPR)与线性离散最优潮流(OPF)模型的配电网规划(DNP)方法,并配套提供了完整的Matlab代码实现。研究聚焦于配电网中的复杂优化问题,通过构建精确的数学模型来描述功率流动、网络拓扑约束及多目标规划需求,旨在提升配电系统的运行效率、可靠性和对不确定性的适应能力。文中深入探讨了模型的构建逻辑,包括对非线性潮流方程的凸化处理与离散化求解策略,并结合智能优化算法有效应对新能源出力(如风电、光伏)与负荷需求的双重不确定性,为解决现代配电网扩容、重构及分布式电源接入等关键问题提供了理论依据和技术路径。此外,文档还关联了丰富的科研方向与技术支持内容,覆盖电力系统优化、微电网调度、不确定性建模与鲁棒优化等领域,凸显其在学术研究与工程实践中的双重价值。; 适合人群:具备电力系统分析、优化理论基础及Matlab编程能力的研究生、高校科研人员,以及从事电网规划、智能电网技术研发的工程师。; 使用场景及目标:①作为教学与科研工具,帮助理解配电网规划的核心原理、SOCPR与OPF模型的数学内涵及其实现细节;②为解决新能源大规模接入背景下配电网面临的不确定性、安全性与经济性协调优化问题提供可复现的算法参考;③作为开发更高级别的综合能源系统规划与鲁棒调度模型的技术基础与验证平台。; 阅读建议:建议读者结合文中提供的Matlab代码进行实践操作,重点剖析SOCPR松弛技巧与线性离散OPF模型的构建过程,通过调试与仿真加深对算法逻辑的理解。同时,可参考文档中提及的相关研究方向(如不确定性建模、鲁棒优化),拓展学习先进的优化技术与仿真方法,以全面提升解决复杂电力系统规划问题的综合能力。
代码转载自:https://pan.quark.cn/s/a4b39357ea24 在基于Ubuntu 20.04的操作系统环境中,将Visual Studio Code(VScode)设置为C/C++编程环境是一项关键的操作,尤其对于追求高效编程环境的工作者而言。本篇图文并茂的指南将逐步指导用户完成这一设置流程。 首先,必须确保获取一个恰当的Ubuntu 20.04镜像文件。在部署Ubuntu的过程中,推荐从官方渠道获取最新且适配于VMware等虚拟机的镜像文件,以此保障安装过程的顺畅性。 安装VScode的操作十分便捷,用户只需在Ubuntu的应用程序商店中检索“VScode”,随后执行安装操作。安装完毕后,即可着手进行C/C++开发环境的设定。 1. **C++插件的部署**:启动VScode程序,通过左侧边栏的Extensions图标搜寻“C++”。识别相关的C/C++插件,比如由Microsoft提供的C/C++扩展,并点击安装。该插件将提供代码自动补全、语法强调显示、错误识别等功能。 2. **项目的建立**:在用户偏好的目录中创建一个新文件夹,将其作为项目的工作区间。例如,用户可以在桌面上建立这样一个文件夹。接着,在VScode中打开此文件夹。 3. **代码的编写**:在上述文件夹内,生成一个名为`main.cpp`的新文档,并开始撰写C++代码。 4. **调试环境的设定**:按下`F5`键或通过菜单选择Run > Starting Debugging,VScode将弹出一个用于选择调试环境的界面。选择C++,并选取默认的g++配置。若`launch.json`文件未被自动创建,再次按下`F5`,VScode将自动生成该文件。 打开`lau...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值