Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [FIXED] Expression list treated as compound exression in functional cast cast [-fpermissive] ?

[FIXED] Expression list treated as compound exression in functional cast cast [-fpermissive] ?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    heatblazer
    wrote on last edited by
    #1

    Hello, I have a simple daemon with init method which has the following declaration:
    @void init_daemon(smain, int, char**)@
    where smain is the following callback to original main function
    @typedef int (smain)(int, char*)@
    I am using the function as follows:
    @void init_daemon(smain s, int argc, char* args[]) {
    int i, lfp;
    char str[10];
    if ( getppid() == 1) {
    /already a daemon/
    return;
    }
    i = fork();
    if ( i < 0 ) exit(1); /* fork error */
    if ( i > 0) exit(0) ; /*parent exit */

    setsid();
    for (i= getdtablesize(); i >=0; --i) close(i) ; //close all descriptors
    
    i = open("/dev/null", O_RDWR); dup(i); dup(i); /* handle standard I/O ??? read further */
    umask(027);
    chdir(getenv("PWD"));
    
    lfp=open(LOG_FILE, O_RDWR | O_CREAT, 0640);
    if ( lfp <0) exit(1);
    if ( lockf(lfp, F_TLOCK, 0) < 0) exit(0);
    
    sprintf(str, "%d\n", getpid());
    write(lfp, str, strlen(str));
    
    signal(SIGCHLD, SIG_IGN);
    signal(SIGTSTP, SIG_IGN);
    signal(SIGTTOU, SIG_IGN);
    signal(SIGTTIN, SIG_IGN);
    signal(SIGHUP, signal_handler);
    signal(SIGTERM, signal_handler);
    smain(argc, args); // --------- > s(argc, args);
    

    }@
    It gives me the error in smain(argc, args) call. The main.c file is as follows:
    @#include <QApplication>
    #include <iostream>
    #include "Daemon.h"
    #include "DirectoryDeleter.h"

    int selfMain(int, char*[]);

    int main(int argc, char *argv[])
    {
    init_daemon(selfMain, argc, argv);
    }

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

    QApplication a(argc, argv);
    QString* s = new QString(argv[1]);
    std::cout << s->toStdString() << std::endl;
    

    // DirectoryDeleter* dr = new DirectoryDeleter(s, &a);
    //DirectoryDeleter
    dr = DirectoryDeleter::getSingleInstance();
    //dr->showProgram();
    DirectoryDeleter::getInstance()->setFileName("DAEMON TESTING")
    ->setQApplication(&a)
    ->setWxH(100,100)
    ->setSleepTime(10000)
    ->build();
    return a.exec();
    }
    @

    Can you explain why is this error?

    Sorry I`ve noticed it ... Dull too much code

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved