相关疑难解决方法(0)

在Visual Studio中禁用或修复#ifdef敏感着色和智能感知

问题:我的语法突出显示和IntelliSense被破坏了.我有一个像这样的C++源文件:

#include "stdafx.hpp"

#ifdef SOMETHING
do_some_stuff;
#endif
Run Code Online (Sandbox Code Playgroud)

where stdafx.hpp(项目的预编译头)包含一个.h文件,其中包含:

#ifdef DEFINE_SOMETHING
#define SOMETHING
#endif
Run Code Online (Sandbox Code Playgroud)

DEFINE_SOMETHING在项目的项目属性中定义(在C++/Preprocessor下).

Visual Studio正在失去跟踪,并do_some_stuff;以纯灰色显示(实际上是很多代码行) - 我既没有语法着色也没有IntelliSense.

问题是:我怎样才能使Visual Studio得到正确的(不太可能)或者关掉它认为已经出现的灰色代码的事实#ifdef

(重新排列代码不是一个选项 - 它是一个庞大而复杂的系统,其文件是在各种环境中构建的,Visual Studio只是其中之一.我使用的是Visual Studio 2005,但我很想知道这是否是在更高版本中修复或可处理.)

visual-studio-2005 syntax-highlighting visual-studio

5
推荐指数
3
解决办法
5475
查看次数

如何在 GCC 中显示“预处理”代码忽略包含

我想知道是否可以使用 gcc 输出“预处理”代码但“忽略”(不扩展)包括:

ES 我得到了这个主要的:

#include <stdio.h>
#define prn(s) printf("this is a macro for printing a string: %s\n", s);

int int(){
char str[5] = "test"; 
prn(str);
return 0;
}
Run Code Online (Sandbox Code Playgroud)

我跑 gcc -E main -o out.c

我有:

/*
all stdio stuff
*/

int int(){
char str[5] = "test";
printf("this is a macro for printing a string: %s\n", str);
return 0;
}
Run Code Online (Sandbox Code Playgroud)

我只想输出:

#include <stdio.h>
int int(){
char str[5] = "test";
printf("this is a macro for printing a string: %s\n", str);
return …
Run Code Online (Sandbox Code Playgroud)

c linux gcc c-preprocessor

4
推荐指数
1
解决办法
1916
查看次数