Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 646539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:37:22+00:00 2026-05-13T21:37:22+00:00

UPDATE: appologies for the wrong place I chose to put stuff. I didn’t notice

  • 0

UPDATE: appologies for the wrong place I chose to put stuff. I didn’t notice those adds @Sinan mentioned at all probably they had been blocked by my browser. Anyway I’ve deleted the links now. and thank you guys 🙂

In my [previous post][1], @daotoad mentioned an Inline module. Now I’m playing around with it. Well, actually except for Perl, I basically know nothing about any other programming languages. The script is written for pure fun. I want to see if I can just throw to my Perl script some code written in other programming language and somehow get it working.

Well, I copied a CPP source code which I found on the Net to my Perl script and I’ve been trying to get it working but all I get is a screenful of error message:
It looks like something’s suspicious with the imported CPP libary but I’m not sure. The following information is part of the error information that caught my eyes:

E:/solarlunar.h:53: error: expected identifier before "false"
E:/solarlunar.h:53: error: expected `}' before "false"
E:/solarlunar.h:53: error: expected unqualified-id before "false"
E:/solarlunar.h:53: error: expected declaration before '}' token
In file included from _3_pl_62cb.xs:19:
E:/solarlunar.h:1:1: unterminated #ifndef
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1'
Stop.

A problem was encountered while attempting to compile and install your Inline
CPP code. The command that failed was:
  nmake > out.make 2>&1

I’ve checked the 53rd line of solarlunar.h file and after a little bit of google about what it might mean I think this line looks pretty innocent but well as a complete C++ newbie I’m not sure:

**typedef enum boolean { false = 0, true = 1 } boolean;** 

I’ve tried compiling and testing the C++ code with DEV-C++ and everything worked like expected.

My script (updated) is this:

    #Inline-Test.pl
 use warnings;
 use Inline 'CPP' => Config => LIBS => 'E:/';
    use Inline 'CPP' => Config => INC  => 'E:/';
 use Inline 'CPP';

    my $args = <STDIN>;     
 chomp $args;
    my $result = main($args); 
    print $result;

__END__
__CPP__


#include <stdio.h>
#include <stdlib.h>
#include "solarlunar.h"
#include "solarlunar.c"

/**//* input format: sl -[s|l]   year.month.day */
/**//* the lunar calendar date range is limited by solarlunar.h: 1899/12/1 ~ 2099.12.30 */

static void usage(void);

int main(int argc, char *argv[])
{
    int year, month, day;
    int i;
    /**//* convert flag, 0: solar convert to luanr. 1: lunar convert solar */
    int convert_f = 0;
    solar_calendar so;
    lunar_calendar lu;

    /**//* input check */
    if( argc < 3 || argv[1][0]!= '-' ||
         !(argv[1][2] == 's' || argv[1][3] == 'l')) {
        usage();
        exit(1);
    }

    /**//* get convert flag */
    convert_f = (argv[1][4] == 's' ? 0 : 1);

    /**//* converting */
    for(i = 2; i < argc; i++) {
        sscanf(argv[i], "%d.%d.%d", &year, &month, &day);
        switch(convert_f) ...{
            case 0:
                so = solar_creat_date(year, month, day);
                lu = solar2lunar(so);
                printf("%d.%d.%d ", lunar_get_year(lu), lunar_get_month(lu), lunar_get_day(lu));
                break;
            case 1:
                lu = lunar_creat_date(year, month, day);
                so = lunar2solar(lu);
                printf("%d.%d.%d ", solar_get_year(so), solar_get_month(so), solar_get_day(so));
                break;
            default :
                exit(2);
        }
    }
        return 0;
}


static void usage(void)
{
    printf("sl -[s|l] year1.month1.day1 year2.month2.day2 ... "
            "-s: solar calendar date convert to lunar calendar date. "
            "-l: lunar calendar date convert to lunar calendar date.");
}

The necessary library can be downloaded from [here] and [here].
Sorry, wrong place to put stuff. links now deleted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:37:23+00:00Added an answer on May 13, 2026 at 9:37 pm

    Your problem stems from the fact that you are trying to compile C source code as C++. The author of this silly program seems want a boolean type in C and therefore defines it using an enumeration:

    typedef enum boolean { false = 0, true = 1} boolean; 
    

    Now, this trips up a C++ compiler because that language has a bool type and true and false are values for that type. The assignment false = 0 is not valid C++.

    It is interesting that the word boolean only appears in one place in solarlunar.c:

    boolean is_leap_year(const int year)
    {
        return LEAP(ABS(year));
    }
    

    changing that function’s return type to int and getting rid of the typedef in solarlunar.h should solve the immediate issue. Compiling the source code as C using gcc resulted in no errors even without those changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: I reported this as a bug to Apple and they fixed it! All
Update: I added the missing two variables to the repo code blush Sincere appologies
Ok, I think this question is at the wrong place and I'll head over
Update: Is there a way to achieve what I'm trying to do in an
update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find
UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
Update : This is no longer an issue from C# 6, which has introduced
UPDATE UPI_ATTRIBUTE SET SITE_INC ='0' WHERE USER_PROFILING_NAME IN ('CAR_IMPLICIT','CAR_EXPLICIT') Above is my query that
Update: Switching to IIS Express instead of the Visual Studio Development Server fixed the
UPDATE 6/21/12 I have a form in rails that is working similar to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.