Parsekit not compiling cleanly - parsekit

I downloaded the latest version from google code, am using xcode 4.4 (with command line tools), 10.7.4 and am getting the error below. Any idea?
In file included from /Users/otusweb/SkyDrive/Projects/parsekit/test/PKTokenNode.m:16:
/Users/otusweb/SkyDrive/Projects/parsekit/include/ParseKit/PKToken.h:42:13:
error: token is not a valid binary operator in a preprocessor subexpression
#if PLATFORM(TWITTER_STATE)
~~~~~~~~^
/Users/otusweb/SkyDrive/Projects/parsekit/include/ParseKit/PKToken.h:67:13: error:
token is not a valid binary operator in a preprocessor subexpression
#if PLATFORM(TWITTER_STATE)
~~~~~~~~^
/Users/otusweb/SkyDrive/Projects/parsekit/include/ParseKit/PKToken.h:168:13: error:
token is not a valid binary operator in a preprocessor subexpression
#if PLATFORM(TWITTER_STATE)
~~~~~~~~^
3 errors generated.

Just downloaded the update that was made on google code to remove the platform preprocessor command and it now works...
Olivier

Related

How do i compile a glib application in windows withnout pkg-config?

I am trying to compile a glib application in windows 10, but i keep getting this error:
In file included from C:\Users\DamŔa\Desktop\C\glib-2.0/glibconfig.h:9,
from C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gtypes.h:32,
from C:\Users\DamŔa\Desktop\C\glib-2.0/glib/galloca.h:32,
from C:\Users\DamŔa\Desktop\C\glib-2.0/glib.h:30,
from main.c:3:
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gmacros.h:818:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^~~~~~~~~~~~~~
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gmacros.h:818:31: note: in definition of macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
while trying to compile it with this command:
gcc -I"C:\Users\Damča\Desktop\C\glib-2.0" main.c
I did some research and found out that it could be because i am not using pkg-config, but it doesn't work on windows, because it cant find the file glib-2.0.pc.
so, how can i compile it withnout pkg-config? or how do i make it work on windows?
The GLib source code for Linux won't work for Windows. Use the Windows version and try again. Set the environment variable PKG_CONFIG_PATH to the .pc file

Preprocessor: error: missing binary operator before token "("

we're curruntly working on a C project and we've downloaded and used the header dirent.h, the problem is the code was compiled successfully on my teammate laptop but in mine it doesn't compile, telling me this :
In file included from utils.c:6:0:
dirent.h: In function '_wopendir':
dirent.h:383:28: error: missing binary operator before token "("
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
^
dirent.h:405:28: error: missing binary operator before token "("
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
^
dirent.h:413:5: warning: implicit declaration of function 'wcsncpy_s' [-Wimplicit-function-declaration]
wcsncpy_s (dirp->patt, n+1, dirname, n);
^
I searched for the problem and find that it's a preproccessor error and currently on the #if
i've tried to add #define WINAPI_FAMILY_PARTITION(Partitions) but it doesn't work.
Please suggest me a solution to compile it successfully, and does the windows version affect on preprocessing?
WINAPI_FAMILY_PARTITION is defined in <winapifamily.h>, probably included by <windows.h>. Look at this question for more explanations, but windows intricacies are largely irrelevant for your compilation issue. You might want include <windows.h> before <dirent.h>?
You did not publish the source code for your program, nor did you specify what OS you compile for not what compiler you use, but you mention we've downloaded and used the header dirent.h... This sounds wrong: system include files such as <dirent.h> are automatically installed with the compiler, they are specific to the OS and compiler, you cannot just download one from the net and expect it to work on your system. It might work by chance on your teammate's PC because the OS might be different.

How to compile VTProlog from source code?

I am a student in Computer Science, and I am learning about logic programming with Prolog.
I have found an interesting Prolog interpreter, VTProlog (https://github.com/Johnicholas/Hello-Github/blob/master/prolog-in-hundreds-of-loc/vtprolog-in-c/vtprolog.pas).
To know more about Prolog, I am trying to compile their source code. And, I got success with Turbo Pascal 7.0, but failed with Free Pascal 2.6.4.
vtprolog.pas(1195,8) Error: Identifier not found "l"
vtprolog.pas(1198,30) Error: Identifier not found "l"
vtprolog.pas(1199,16) Error: Identifier not found "l"
vtprolog.pas(1203,34) Error: Identifier not found "l"
vtprolog.pas(1611) Fatal: There were 4 errors compiling module, stopping
vtprolog.pas(0) Fatal: Compilation aborted
Is there any way to compile it both with Turbo Pascal 7.0 (without any requirement) or Free Pascal 2.6.4 on Windows XP?
Without knowing too much about Pascal I think the problem is that part of line 1159:
Procedure print_functor (* l : node_ptr *) ;
has been commented out. Change that to:
Procedure print_functor (l : node_ptr) ;
and it should compile - at least it did when I tried with Ideone (using the Free Pascal Compiler). If the program will work as intended I can't say.
Did you put Free Pascal in strict Turbo Pascal Mode with -Mtp ? If I do it compiles, even with older 2.6.2.
D:\testing>fpc vtprolog.pp -Mtp
Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling vtprolog.pp
vtprolog.pp(222,3) Note: Local variable "num" is assigned but never used
vtprolog.pp(310,3) Note: Local variable "s" not used
vtprolog.pp(1253,13) Note: Local variable "p" not used
vtprolog.pp(100,3) Note: Local variable "source_file" not used
vtprolog.pp(102,13) Note: Local variable "text_chars" is assigned but never used
vtprolog.pp(103,46) Warning: Variable "HeapPtr" read but nowhere assigned
Linking vtprolog.exe
1610 lines compiled, 0.3 sec , 43712 bytes code, 2204 bytes data
1 warning(s) issued
5 note(s) issued
For ideone, you can simulate the commandline parameter by adding {$mode tp} as first thing in the file (before the (*$V-... *) line ). I tested it with ideone, and it compiled.

Preprocessor #define LIBVER {'1','5'} check

I am receiving libraries with include files, where version is described like below:
#define MSIF_DMX_LIBVER {'1','5'} //LIB version
Problem is that I want to make conditional compilation based on the lib version. For example there are more enums in version 1.5 than 1.4, which I would like to use.
When I tried with:
#if (MSIF_DMX_LIBVER == {'1','5'})
Compilation failed with following error message:
error: token "{" is not valid in preprocessor expressions
Is it possible to make some preprocessor condition on that case? I don't want to modify every header file I get from 3rd party.

Compilation error in visual C++

I am using Visual studio 2010 for building C project. My project contains a number of header files,source file and parsers. It uses lex and bason files. I am getting a single error during the compilation and íé the following
abc.y:error C2065: 'INPUT' : undeclared identifier
I tried the solutions I am getting like including
#define WIN32_WINNT >= 0x0501
in my main.c file before the inclusion of any of the header files.I am not able to get rid of this error. Could you please let me know what Can be the reasons for this error?
EDIT
The snippet of code that is showing error is:
list_Cons(0, list_List((POINTER)INPUT)
The surprising thing is that If i alter INPUT into INPUT1, I get the same error. It is stoic to change.
Presumably you read this and this.
#define WIN32_WINNT >= 0x0501 wont work. You should try using #define WIN32_WINNT 0x0501 instead.
Also, check that you are actually #including winuser.h
A C++ compiler cannot process a *.y file. For that you need a yacc / bison program, which does not come included with Visual Studio 2010.
For myself I use CMake which can generate MSVC projects along with other build types. You can tell it that a .y needs to be processed outwith the C/C++ files and it will instruct MSVC to invoke whatever external tools are necessary to preprocess the non-C/C++ parts.

Resources