C code completion in CodeBlocks - codeblocks

I am working on a C project on CodeBlocks,
but I still have C++ results when using the autocompletion.
Do you know how to keep only the C completion?

In Settings>Editor>Code Completion the C/C++ parser options, allow you to alter the header files and extensions to parse.
Have you tried removing the C++ stuff?

Related

How to set breakpoints in Xcode for files with obscure file extensions?

I'm working on a project that uses Rust, so the files have an extension of .rs. Xcode won't let me set breakpoints. It seems it just handles the file as plain text. Is there any way to get it to allow me to set breakpoints in .rs files? One solution is to mark each .rs file as being some type of source code file that Xcode recognizes, e.g. an Objective-C source code file, but I'm looking for something that will apply globally to all .rs files.
Xcode doesn't support Rust, and Rust files are plain text files for Xcode. Xcode debugger is just for C languages (C, C++, Objective-C) and Swift. Declaring .rs files as Objective-C only makes Xcode assume that they are Objective-C code.
You need a Rust IDE for debugging Rust code.

How can I hook the preprocessor in Clang, XCode, and MSVS? (GCC works)

I'm using an external preprocessor (pyexpander) for my cross-platform/cross-IDE c++ project*. GCC already works nicely with the -no-integrated-cpp -B${PWD} option. I could manually preprocess each file into a specific temp dir, then compile the processed files. But is there a better way? Specifically, I'd love to hook the native preprocessors so IDE-level code analysis is happy (code completion and error checking). Any hints how I can achieve this would be much appreciated.
*"But why not use c++ macros?" They can't do macro-macros and I need that.
*"But why not use m4?" Because python happens to already be a requirement for this codebase, and m4 seems to not come with MSVS and thus would be yet another requirement/point of failure. I would still have to resolve the original preprocessor problem.
*"But why not use language something_better?" Because I have no choice in the matter. (Though I would love to use nim all the way!!)

Adding code-completion to Jetbrain's CLion IDE?

I'm writing a CPython extension using Jetbrain's CLion IDE and I was hoping to get code-completion working for functions and variables inside of Python.h.
I looked through the preferences and I can't find anything relevant. How do I add code completion and inspection for included libraries?
CLion uses the CMakeLists.txt in your project to control the lookup paths for code completion and other features -- because your library includes are build specific, it makes sense in a way to put this here.
To the specific question of how to get the Python.h library signatures into autocomplete, your CMakeList file should have something like the following:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/include/python3.4m")
Where -I/path/to/file.h is the local path to the directory that contains the header files that you want to include in your build (and by proxy, your autocomplete lookup for the project).

Visual C++ Code Completion When Coding in C

When I use Visual C++ for making C++ programs I see auto completion popup when I specify a namespace like std::
I want a similar feature for when I use this IDE to code in C, but since C has no namespaces, auto completion doesn't automatically popup as I type, unless I hit Ctrl+J.
It only pops up when I want to include files using the #include directive.
Is there a way to enable this feature for C, or does the IDE lack it completely?
Try Visual Assist X. It can handle code auto-completion for C / C++ / C# code.

Compiling libexif as static lib with Visual Studio 2010 - then linking from Visual C++ project

Is it possible to compile libexif with Visual Studio 2010? I have been trying to do so and have been running into a whole slew of problems. I cannot find any information about whether anybody has successfully done this before. I know I can use MinGW to compile the library, but I am in a situation where I need it to be compiled with Visual Studio and then need to link to it from a Visual C++ app. Is this possible?
To answer your question: Yes it is possible... but it is a bit of a hack. Libexif uses functions that MSVC has chosen not to implement. See my working example VS2010 project below (if you don't like downloading files then skip to my explanation of what needed changing to get it to work below):
https://www.dropbox.com/s/l6wowl8pouux01a/libexif-0.6.21_CompiledInVS2010%2BExample.7z?dl=0
To elaborate, the issues that needed a "hack" (as hinted in the LibExif readme-win32.txt documentation) are:
Libexif uses inline in several places which is not defined in VS for C, only C++ (see this)
Libexif uses snprintf extensively in the code which is not defined in VS (see here)
You need to create the config.h yourself without a ./configure command to help you. You could read through the script but most of it doesn't make sense for Windows VS2010.
You will need to define GETTEXT_PACKAGE because it's probably setup in the configure file. I just choose UTF-8, whether that is correct or not I'm not sure.
There was a random unsigned static * that needed to be moved from a .c file to the .h file as C in VS doesn't allow you to create new variables inside functions in the particular way they were trying to do.
Read the "readme-win32.txt" file. Advice is:
hack yourself a build system somehow. This seems to be the Windows way of doing things.
Don't get your hopes up. The *nix way of doing things is the configuration script that needs to be run first. It auto-generates source files to marry the library to the specific flavor of *nix. The configuration script is almost half a megabyte. Three times as much code as in the actual .c files :) You cannot reasonably get that working without MinGW so you can execute the script. Once you got that done, you've got a better shot at it with a VS solution. As long as it doesn't use too much C99 specific syntax.

Resources