Foundation.h on Windows - windows

I know these questions have been asked before but everything suggest using GNUStep. Is there a way to use Foundation without GNUStep? This is also a learning question for me (like if it's possible to do by linking files or something)
I have Cygwin and gcc installed. I got all the Libraries from CocoaTron as in here: http://code.google.com/p/cocotron/source/browse/
I added the library folder to the OBJC_INCLUDE_PATH and the C_INCLUDE_PATH and it doesn't complain about not being able to find Foundation.h anymore.
But I get other errors like:
$ gcc intro.m -o intro
In file included from /cocoa/CoreFoundation/CFBase.h:144,
from /cocoa/CoreFoundation/CFAttributedString.h:8,
from /cocoa/CoreFoundation/CoreFoundation.h:42,
from /cocoa/Foundation/Foundation.h:37,
from car.h:1,
from intro.m:2:
/cocoa/CoreFoundation/CFString.h:88: error: parse error before "va_list"
In file included from /cocoa/Foundation/NSAffineTransform.h:9,
from /cocoa/Foundation/Foundation.h:41,
from car.h:1,
from intro.m:2:
/cocoa/Foundation/NSGeometry.h:9:32: Foundation/NSObject.h: No such file or directory
In file included from /cygdrive/d/Allebrum Resources/C Libraries/cocoa/Foundation/NSAffineTransform.h:9,
from /cygdrive/d/Allebrum Resources/C Libraries/cocoa/Foundation/Foundation.h:41,
from car.h:1,
from intro.m:2:
I'm sorry for the novice question, I was just interested in running a few test and didn't want to install GNUStep.
I mean, a really simple example like:
//car.h
#import <Foundation/Foundation.h>
#interface Car : NSObject{
}
- (void)addGas;
#end
#include <stdio.h>
#import "car.h"
int main(int argc, const char * argv[]){
printf("Hello");
return 0;
}
Yes, I know this example doesn't need objC ;) I was just trying to follow along with a tutorial.
Thanks for the help!

Looking at the Cocotron's requirements page and general information page, it seems that it only supports development on the Mac. What it provides is the ability to build a Windows- or Linux-compatible product… on your Mac.
So, as far as I can tell, at this time, you can't use Cocotron to develop on Windows. You'll still have to use GNUstep.

Related

Setting sdkconfig using platform.io for the ESP32

I was wondering if anybody managed to set the SDKConfig.h file for the ESP32 when using platform.io to upload code, and if so how it is done.
Thanks in advance!
✌️
You can copy and modify the file SDKConfig.h into your project include folder from:
/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config/
or paste "CONFIG_ULP_COPROC_RESERVE_MEM" in your code and <Ctrl+LClick> to go to this file in your system.
And add this to your platformio.ini so that the file in your project has priority
build_flags =
-Iinclude
Tested with framework-arduinoespressif32 Version 3.10006.210326 (1.0.6)
Let me know if it works for you, I'm guessing it could work with the other frameworks?
if some of the definitions gives you a problem because they are defined elsewhere just add a guard like this:
#ifndef CONFIG_FLASHMODE_DIO
#define CONFIG_FLASHMODE_DIO 1
#endif

where is the interface header file of HIDL in AOSP?

I studied the HIDL using Nfc code in AOSP .
As i know, when INfc.hal is compiled, INfc.h is autogenerated like following picture.
In NxpService.cpp, there is code like following
#include <android/hardware/nfc/1.1/INfc.h>
But, I couldn't find that path.
where is the real path of android/hardware/nfc/1.1/INfc.h?
In addition, I became curious how gcc compile works in NxpService.cpp that uses INfc.h.
Could you explain how gcc compiler can find INfc.h and work without compile error?
INfc.hal
Path: /hardware/interfaces/nfc/1.1/INfc.hal
Android.bp
hidl_interface {
name: "android.hardware.nfc#1.1",
root: "android.hardware",
NxpService.cpp
Path: /hardware/nxp/nfc/1.1/NxpService.cpp
#include <android/hardware/nfc/1.1/INfc.h>
...
int main(){
sp<INfc> nfc_service = new Nfc();
status_t status = nfc_service->registerAsService();
android.hardware.nfc#1.1 would be at hardware/interfaces/nfc/1.1/ here.
The mappings for Android provided interfaces to their actual location are shown here https://source.android.com/devices/architecture/hidl/interfaces.
The files you look for are all auto-generated by hidl-gen, and they usually locate in out directory, e.g.
$ANDROID_ROOT/out/soong/.intermediates/hardware/interfaces/nfc/1.1/android.hardware.nfc#1.1_genc++_headers/gen/android/hardware/nfc/1.1

Undefined reference for a specific library: FastNoiseSIMD

I'm new to C++ and I'm trying to include a header file from this library, https://github.com/Auburns/FastNoiseSIMD
When I write this line, FastNoiseSIMD* myNoise = FastNoiseSIMD::NewFastNoiseSIMD(); I get the error: main.cpp:36: undefined reference to FastNoiseSIMD::NewFastNoiseSIMD(int)
Here is how I'm including the header:
#include "FastNoiseSIMD/FastNoiseSIMD/FastNoiseSIMD.h"
As you can see, the files are in folders that are located in the working directory of my program. I'm working on Linux using c++11 and g++. I don't see any library files that I need to link so I'm stuck here.
Any help is greatly appreciated. Thank you.
Check this undefined-reference-to-pow-and-floor

Is it possible to use rb_cIPSocket in ruby C extension

I am learning how to write Ruby C extensions and I'm past the simplest examples. I was trying to achieve something with sockets so I attempted to create an extension which would define a class under rb_cIPSocket.
At the top of my C file I have:
#include "rubysocket.h"
And I am receiving:
...s.c:3:31: error: rubysocket.h: No such file or directory
Which is most probably the case. However, I tried all possible paths:
#include "rubysocket.h"
#include "socket/rubysocket.h"
#include "ext/socket/rubysocket.h"
#include <rubysocket.h>
#include <socket/rubysocket.h>
#include <ext/socket/rubysocket.h>
And this is my extconf.rb:
require 'mkmf'
dir_config("my_ext")
have_library("c", "main")
create_makefile("my_ext")
And so on. What am I actually missing here? Why can't I include that header file?
I am using OSX with RVM and Ruby 1.9.3-p448.
Thank you.
where does rubysocket.h live? If it's in the heart of ruby's source code then odds are it is "private" for ruby's use, but you can look it up like...
VALUE ipSocketClass = rb_const_get("IPSocket");
or the like.
GL!

How to instrument gcc?

I have to instrument gcc for some purposes. The goal is to be able to track what GCC functions are called during a particularly compile. Unfortunately I'm not really familiar with the architecture of GCC so I need a little help. I tried the following steps:
1) Hacking gcc/Makefile.in and adding "-finstrument-functions" flag to T_CFLAGS.
2) I have an already implemented and tested version of start_test and end_test functions. They are called from gcc/main.c, before and after toplev_main() call. The containing file is linked to gcc (the object is added to OBJS-common and the dependency is defined later in gcc/Makefile.in)
3) Downloading prerequisites with contrib/download_prerequisites.
4) Executing the configuration from a clean build directory (on the same level with the source dir): ./../gcc-4.6.2/configure --prefix="/opt/gcc-4.6.2/" --enable-languages="c,c++"
5) Starting the build with "make all"
This way I runned out of memory, although I had 28G.
Next I tried to remove the T_CFLAGS settings from the Makefile and give -finstrument-functions to the make command: make CFLAGS="-finstrument-functions". The build was successful this way but when I tried to compile something it resulted empty output files. (Theoretically end_test should have written its result to a given file.)
What do I make wrong?
Thanks in advance!
Unless you specifically exclude it from being instrumented, main itself is subject to instrumentation, so placing calls to your start_test and end_test inside main is not how you want to do it. The 'correct' way to ensure that the file is opened and closed at the right times is to define a 'constructor' and 'destructor', and GCC automatically generates calls to them before and after main:
void start_test (void)
__attribute__ ( (no_instrument_function, constructor));
void end_test (void)
__attribute__ ( (no_instrument_function, destructor));
/* FILE to write profiling information. */
static FILE *profiler_out;
void start_test (void)
{
profiler_out = fopen ("profiler.out", "w");
if (profiler_out == NULL)
exit (-1);
}
void end_test (void)
{
fclose (profiler_out);
}
Footnotes:
Read more about constructor, destructor and no_instrument_function attributes here. They are function attributes that GCC understands.
Read this excellent guide to instrumentation, on the IBM website.

Resources