Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6389539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:24:57+00:00 2026-05-25T03:24:57+00:00

I am using ctags to generate a tags file for a C project I

  • 0

I am using ctags to generate a tags file for a C project I am working on, but many functions are missing in the file. This appears to be caused by unbalanced braces in the source files due to using #ifdef. A (simplified) example:

#include <stdio.h>

struct mystruct {
        long member;
#ifndef _MSC_VER
}__attribute__ ((packed));
#else /* _MSC_VER */
};
#pragma pack(pop)
#endif /* _MSC_VER */

char* greeting_text(){
  return "Hello world\n";
}

int main( int argc, const char* argv[] ){
  char * greeting = greeting_text();
  printf(greeting);
  return 0;
}

This compiles and works flawlessly with gcc -Wall under Linux. However, if I parse it using ctags problem.c, the tags file only contains entries for mystruct — the functions are missing.

ctags --verbose reports:

OPENING problem.c as C language file
problem.c: unexpected closing brace at line 8
problem.c: retrying file with fallback brace matching algorithm
OPENING problem.c as C language file
problem.c: unexpected closing brace at line 8

so apparently ctags does not like the preprocessor tricks in the file.

Is there a way to make ctags handle this?

The manpage of ctags even explicitly mentions this problem, but indicates ctags can work around this. However, this does not appear to work…

This is with Exuberant Ctags 5.8 (Debian package 1:5.8-4).

Edit:

I’m also interested in alternatives to ctags that handle these kinds of constructs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:24:57+00:00Added an answer on May 25, 2026 at 3:24 am

    Because of the problems with ctags, I ended up using cscope instead.

    While it’s not perfect, it handles macros better than ctags, and it can integrate with vim just like ctags can (see http://vimdoc.sourceforge.net/htmldoc/if_cscop.html#:cscope ).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Exuberant ctags to index Erlang files. The tags file contains functions, but
I'm trying to generate tags for the C Standard Lib using Exuberant Ctags 5.8,
I'm using ctags to create a tags file for use in Vim, so that
I am using ctags to create tags for my Emacs to read symbols from,
I'm using Zend_Reflection to generate an extended format set of ctags for use with
I just started using ctags and greatly appreciate the tool but the way I
I'm using vim's taglist plugin to navigate source files in my project, but I've
Using vim 7.3.1, ubuntu 11.10 I am creating a tag file using ctags while
I am using Exuberant Ctags 5.7. I am trying to build a tag database
Using TortoiseSVN against VisualSVN I delete a source file that I should not have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.