LINUX.ORG.RU

Не компилится одна старая прога.


0

0

Эта прога называется con2fbmap из комплекта fbtools, который датируется маем 99 года. Дистриб - Slackware 9

вот лог:

uzver@zero:/usr/local/src/fbutils/con2fbmap$ make con2fbmap g++ -Wall -I../include -O2 -c con2fbmap.C -o con2fbmap.o con2fbmap.C: In function `int main(int, char**)': con2fbmap.C:54: could not convert `argv' to `const char**&' ../include/util.h:25: in passing argument 2 of `int GetNextOption(int&, const char**&, const option*, unsigned int)' make: *** [con2fbmap.o] Error 1 uzver@zero:/usr/local/src/fbutils/con2fbmap$

anonymous

попробуй найди main().

Там должно быть что-то типа
int main( const char **argv, int argc )
{
...
}

Замени это типа так:
int main( const char **av_freak, int ac_freak )
{
const char **argv = av_freak;
int argc = ac_freak;

...
}

и посмотри, вдруг сработает..

dilmah ★★★★★
()

Вот это дело:

#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <sys/types.h>

#include "config.h" #include "framebuffer.h" #include "util.h"

bool Opt_version = false; bool Opt_verbose = false; const char *Opt_debug = NULL; const char *Opt_fb = DEFAULT_FRAMEBUFFER; const char *Opt_console = NULL; const char *Opt_framebuffer = NULL;

enum { ID_HELP = 1 };

const struct option Options[] = { { ID_HELP, 'h', "help", NULL, 0 }, { 0, 'V', "version", &Opt_version, 0 }, { 0, 'v', "verbose", &Opt_verbose, 0 }, { 0, 0, "debug", &Opt_debug, 0 }, { 0, 'f', "frame-buffer", &Opt_fb, 1 }, };

u_int DebugMask = 0;

// Print the Usage Template and Exit

static void Usage(void) { Die("\nUsage: %s [options] console [framebuffer]\n\n" "Valid options are:\n" " -h, --help : Display this usage information and " "exit\n" " -v, --verbose : Verbose mode\n" " -f, --frame-buffer dev : Framebuffer device to usei (default: " "%s)\n" "\n", ProgramName, Opt_fb); }

int main(int argc, char *argv[]) { int id;

while ((id = GetNextOption(argc, argv, Options, sizeof(Options)/sizeof(*Options)))) switch (id) { case ID_HELP: Usage();

default: if (!Opt_console) Opt_console = argv[0]; else if (!Opt_framebuffer) Opt_framebuffer = argv[0]; else Usage(); argc--; argv++; } if (Opt_debug) DebugMask = strtoul(Opt_debug, NULL, 0);

if (Opt_version || Opt_verbose) puts(VERSION);

FrameBuffer fb(Opt_fb); Con2FBMap map; if (!Opt_console) Usage(); map.console = atoi(Opt_console); if (Opt_framebuffer) { map.framebuffer = atoi(Opt_framebuffer); map.Set(fb); } else { map.Get(fb); map.Print(); }

exit(0); }

anonymous
()

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>

#include "config.h"
#include "framebuffer.h"
#include "util.h"


bool Opt_version = false;
bool Opt_verbose = false;
const char *Opt_debug = NULL;
const char *Opt_fb = DEFAULT_FRAMEBUFFER;
const char *Opt_console = NULL;
const char *Opt_framebuffer = NULL;


enum { ID_HELP = 1 };

const struct option Options[] = {
    { ID_HELP, 'h', "help", NULL, 0 },
    { 0, 'V', "version", &Opt_version, 0 },
    { 0, 'v', "verbose", &Opt_verbose, 0 },
    { 0, 0, "debug", &Opt_debug, 0 },
    { 0, 'f', "frame-buffer", &Opt_fb, 1 },
};

u_int DebugMask = 0;


    //  Print the Usage Template and Exit

static void Usage(void)
{
    Die("\nUsage: %s [options] console [framebuffer]\n\n"
        "Valid options are:\n"
        "    -h, --help             : Display this usage information and "
                                      "exit\n"
        "    -v, --verbose          : Verbose mode\n"
        "    -f, --frame-buffer dev : Framebuffer device to usei (default: "
                                      "%s)\n"
        "\n", ProgramName, Opt_fb);
}

int main(int argc, char *argv[])
{
    int id;

    while ((id = GetNextOption(argc, argv, Options,
                               sizeof(Options)/sizeof(*Options))))
        switch (id) {
            case ID_HELP:
                Usage();

            default:
                if (!Opt_console)
                    Opt_console = argv[0];
                else if (!Opt_framebuffer)
                    Opt_framebuffer = argv[0];
                else
                    Usage();
                argc--;
                argv++;
        }
    if (Opt_debug)
        DebugMask = strtoul(Opt_debug, NULL, 0);

    if (Opt_version || Opt_verbose)
        puts(VERSION);

    FrameBuffer fb(Opt_fb);
    Con2FBMap map;
    if (!Opt_console)
        Usage();
    map.console = atoi(Opt_console);
    if (Opt_framebuffer) {
        map.framebuffer = atoi(Opt_framebuffer);
        map.Set(fb);
    } else {
        map.Get(fb);
        map.Print();
    }

    exit(0);
}

anonymous
()

а ну так блин -- argv аргумент то там объявлен как argv[] -- а это не lvalue -- а потом они пытаются его по ссылке передать другой функции.

действительно попробуй

int main(int argc, char *argv[])
{

Заменить на

int main( int ac_stub, char const **av_stub )
{
int argc = ac_stub;
char **argv = (char **)av_stub;

или еще проще на:

int main(int argc, char **argv)
{

dilmah ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.