Eclipse CDT Inclusion problems - c

I just installed Eclipse CDT. Now, Eclipse works fine for me with Java, but it's not working at all with C. I'm trying to write a simple Hello World program, and I've even loaded the Hello World ANSI premade project. However, regardless of what I do, I get a "Unresolved Inclusion: _" error on all my #include.
I've looked around for half an hour trying to figure out why, installed MiniGW and tried a ton of different configurations. Can someone tell me how to fix this? I'm guessing it's because Eclipse has no idea where the .h files are. How do I set this?
I'm on Windows 7.
Thanks!

Go to the project property (right click on the project in the left panel) then C/C++ General then Paths & Symbols.
You can configure the include paths in the Include tab (the first one normally).
The include paths must be something like $MINGW_DIR/include or something like that (can't be more precise, for me it's /usr/include so...)

Related

Package C console application (Visual Studio '13)

I wrote a basic program for my mom, and now I want her to be able to use it. Obviously, it works on my computer. Getting the .exe file from the project folder, and putting it on her computer doesn't work: it says MSVCR120d.dll is missing whenever the .exe is run. Makes sense--as her computer doesn't have Visual Studio on it. However, I tried installing the Visual C++ Redistributable Packages for Visual Studio 2013, and that didn't work either.
To be honest, I'm not looking to spending hours of time to piece this all together. This is something I will more than likely never do again--I've already done some searching and can only find subjects speaking of C++ distributions. I want a way to get the console app on her computer to work.
The more easy way is link statically. That mean embed all the needed code to the app to run, in the final binary (.exe), eliminating dependency of other libraries.
Go to Project Properties
Go to Configuration Properties
Go to C/C++
Go to Code Generation
Change Runtime Library (in Debug to Multi-Threaded Debug /MTd and in Release to Multi-Threaded /MT)

Prefix headers in other IDEs than Xcode

The prefix header functionality in Xcode comes in handy quite often and I was wondering if other IDEs provide a similar functionality? Or is there even a way on compiler level?
I've been looking for this in other environments for quite a time and the only thing I could find were precompiled headers. But that's not really the same as you still need to include the header file in each source file.
So, does anyone know if there's a way to configure prefix headers in IDEs like Visual Studio or QT Creator?
For VC++ you can specify Forced Include File using option /FI on command line or through an IDE. An excerpt from MSDN:
To set this compiler option in the Visual Studio development
environment:
1. Open the project's Property Pages dialog box.
2. Click the C/C++ folder.
3. Click the Advanced property page.
4. Modify the Force Includes property.
For QtCreator you can add two lines to your *.pro file:
CONFIG += precompile_header
PRECOMPILED_HEADER = stdafx.h
Of course, you can type any name instead of "stdafx.h"

Adding GraphicsMagick to an Xcode project

I have created a Foundation Tool in Xcode, and want to use some functions from the GraphicsMagick image manipulation library. The library has been compiled and installed on my computer using MacPorts. I added libGraphicsMagick.3.dylib and libGraphicsMagickWand.2.dylib to my project as external frameworks.
What other steps must I take to use these libraries in my application, and how would I import their headers to use their functions in my code?
Thanks
UPDATE: Made some progress. Used the .a static libraries instead of the dylibs, added them to my project, then added the header files for magick and wand. I'm trying to compile, but I get this error:
alt text http://cl.ly/f4233cddbae23e1a19fc/content
Searched around a bit, and apparently this problem occurs because 2 of the typedef enum declarations that GraphicsMagick and ImageMagick use are already defined in OS X framework headers. The enums in question are ColorInfo and ExceptionInfo.
The only way to fix it is to go through the source and rename every occurance of those enums to a new name that isn't already taken. However, the iPhone does not have this issue and GraphicsMagick will compile just fine. Unfortunately, I don't think the people behind the library are willing to rename their enums just to get it to compile on OS X.

Where are the C header files in Windows?

I'm new to Windows development, having messed around in Linux for a while. I need to access console functions and am having trouble getting a comprehensive list of console text attributes off the web. I would like to read wincon.h and windows.h to get the info, but I can't figure out how to get at them. Help please!
Windows does not come with these by default. If you are looking for them, you need to install the Windows SDK and dig around in the %PROGRAMFILES%\Microsoft SDKs\Windows directory.
They're normally stored along with the other SDK headers. Assuming you're using Visual Studio, the easy to look at them is to create a file, add a line to #include the file you care about, right click it, and click on the open document <whatever.h> line in the pop-up menu.
You'll have to install the Windows SDK to get the header files. Windows doesn't come with the software development tools out of the box and depending on which compiler you're using, they might not come with the compiler either.
I would try looking up the console function listing on MSDN

Compiling a C library so it can be used in an iPhone static library

I've never done this before, so I'm not sure where to even start. I have a few projects where I want to use the liblio library, both on the iPhone and OS X. I've put the installation instructions in a gist.
Here are my questions, and I'll try and edit these questions as I figure them out.
Do I want to use make install to compile these files? I feel like all the compilation should be done within XCode.
It looks like there are a lot of platform specific settings during compilation. How do I control this from XCode?
It seems like I should be able to add all the .h/.m files to my XCode project and compile them myself. Is this missing something?
For the record, I'm aware of a few LibLO libraries created for use on the iPhone. I may break down and use one, but I'd prefer to learn how to do this myself.
Yes, if you want to compile these projects from within XCode, you need to add the .c/.h files and then setup them accordingly. XCode has support for passing argument to the compiler of course, so it is indeed possible.
From the gist snippet, it looks like the installation instructions are GNU standard instructions, ie. configure; make; make install. You could try playing with arguments to configure (which, btw, creates the Makefile on the spot) and see what options you have for compiling to a different target platform.
However, it may not be worth all the trouble to convert the Makefile's to a pure XCode project. Another approach, which I think I would start with, is to hack the created Makefile until you are able to compile an iPhone friendly lib-file. After that you can tell XCode to run 'make ...' as part of your projects build steps. Then, once you understand the issues, it may be easier to include them in your XCode project proper.
I have not tried this myself, but Building autoconf-configured libraries for iPhone OS might have some useful information for you.

Resources