How to configure a pure C project in QT Creator? - clang

In QT Creator 4.0.1, how to configure a non-QT project (i.e. with project.config, project.files, project.includes) to analyze code with only C (and not C++) in mind.
For example, in C this warning should not appear.
I guess there is something to configure in the clang code model but I can't figure it out where.

Related

How to use C Compiler for esp8266

i have been working with platformio for a few weeks now and have been able to create quite a bit for my microcontroller (atmega328p). I have always tried to get away from the Arduino structure. So no “void setup” or “void loop” but simple C.
Now I got a ESP8266, which I would like to compile with a C environment.
When I create the project now (for the 12E) it asks which framework I should use. I have tried them all by replacing the Arduino setup and loop with the int main(){} function, however it always came up with errors. Does anyone know how I can use a pure C environment for the ESP8266?

Porting OCaml compiler to iOS with a Swift Package

I'm currently trying to create a Swift Package (or Cocoa Touch Framework or anything that can be imported into an Xcode Swift Project) to wrap the OCaml compiler into an iOS app.
My goal is to allow an iOS app to dynamically build and run OCaml code from the device. (without requiring an external server or whatever else to build and run the code, but do it directly on the device)
Here are resources I used to document myself and find a solution:
The OCaml compiler itself (written in C): https://github.com/ocaml/ocaml
How to Integrate a C Library into an iOS App Written in Swift: https://medium.com/#distillerytech/how-to-integrate-a-c-library-into-an-ios-app-written-in-swift-ef92c0e0d42b
Trying to understand how the port was done for python for ios: https://github.com/holzschu/python3_ios and https://github.com/holzschu/cpython
Compiler from OCaml to Javascript: https://github.com/ocsigen/js_of_ocaml
The Xcode project I tried to setup using the tutorial above (2° dash) wrapping the OCaml compiler with a git submodule (see .gitmodules file): https://github.com/NathanFallet/OCamlKit
But I'm unable to compile the package I tried to setup to achieve this goal.
Help is welcomed to realize this huge project

Is it possible to refactor Objective-C++ code in Xcode

I am a game developer. I have developed a game using box2d which is in Final Phase. To structure the code when i attempt to make code refactoring i am receiving this error alert http://screencast.com/t/ir1nCvnx . But when i attempt to make code refactoring for another project which is not using .mm suffix means i can make it out. The thing i want to know is can we do code refactoring for the code using c++ concepts. If not what is other way to do code refactoring.
I thought because Xcode depended on the clang front end for all of its
code coverage features, that it would eventually be able to refactor
C++. As I understood it, it didn't refactor C++ in the past because
clang's C++ support was still insufficient.
But clang is a very good C++ compiler now. Yet Xcode still balks at
even renaming symbols (the only refactoring I've ever needed).
So, till now, you can not refactor your C++ code and hope you will get it with new release of clang / LLVM / XCode.

OpenCV ZXing incompatibility on iOS

I'm trying to work with ZXing and OpenCV in the same project. You wouldn't think this would be this rare of thing to do, but I guess it is. I am having some serious compatibility issues between the two. I can only get one imported without the other.
I start with OpenCV and everything works fine. Program runs as expected. Then I add ZXing, and I get about 27 compiler errors. There is a stackoverflow question that address this here. So I change my C++ compiler settings to match what this question suggests, and it fixes the ZXing problems, but then opens up a whole new set of errors. These errors are related to OpenCV now(see below).
EDIT:
It seems that depending on the C++ compiler, its a one-or-the-other type deal. In fact, if you change the c++ standard library from libc++ to libstdc++ you will get one to work and not the other. No way I can see to get both at the same time
I have found a solution to my question. This applies best to anyone using zxing and opencv in the same project.
Go to the project settings -> Target -> search for c++
a. Switch c++ Language Dialect to Compiler Default
b. Switch C++ Standard Library to libc++
Go to the ZXingWidget.xcodeproj -> ZXingWidget -> search for C++
a. Switch c++ Language Dialect to Compiler Default
b. Switch C++ Standard Library to libc++
There will be a compiler error saying that ZXing can't compile to libc++ because it's currently set to support iOS 4.3. Go into ZXing widget again, and change the deployment target to be 5.0 (sorry all of you trying to still support < 5)
This fixed my problem. Basically what was happening is that zxing and open cv were compiling on different versions of c++, which was causing some strange issues
Edit: For reference, I was using ZXing 2.1 and OpenCV 2.4.3 (Newest versions at the time of the question)
Actually, I use your solution but a little different. At step2,I change both to Complier Default, because if I use your suggestion,the error still there.So I checked the setting in ZXingWidget.xcodeproj and found that it set both Complier Default, so I changed my project setting the same as ZXingWidget.xcodeproj.
But thanks to your hint and helped me a lot!

OpenCV on Erlang

I would like to use OpenCV in my Erlang application. One solution would be to write an Erlang port etc., but I'm sure it has been done before.
The ideal result would be to be able to configure OpenCV from Erlang, and never touch a line of C code. But is this possible ? How would you do that ?
Why not wrap the specific OpenCV configuration in a C application using the OpenCV C lib and call that app using Result = os:cmd('myapp'). That way you don't have to mess around with possible interoperability issues and have a clear separation between you C and Erlang code.

Resources