Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error "Stray '@' in program" in qt



  • I'm building a Application on mac use Qt 5.0.2 , mac version 10.7.4. I want to use xcode in project. Example "Here ...":http://developer.apple.com/library/mac/#featuredarticles/FileSystemEvents/_index.html but Error display "Stray '@' in program" .This is my code

    Watcher.pro
    @
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = TestWatcherImage
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h
    FileSystemWatcherOSX.h

    FORMS += mainwindow.ui

    OTHER_FILES +=
    FileSystemWatcherOSX.mm

    OBJECTIVE_SOURCES += FileSystemWatcherOSX.mm
    LIBS += -framework AppKit
    LIBS += -framework CoreFoundation
    LIBS += -framework CoreServices
    LIBS += -framework CarbonCore
    @

    FileWatcher.hpp
    @
    #include <QString>

    #include <Foundation/NSString.h>
    #include <Foundation/NSFileManager.h>
    #include <Foundation/NSArray.h>

    class FileSystemWatcherOSX
    {
    private:
    FileSystemWatcherOSX();
    public:
    ~FileSystemWatcherOSX();
    static FileSystemWatcherOSX* singleton();
    private:
    void registerDefaults();
    void initializeEventStream();
    void addModifiedImagesAtPath(NSString* path);
    void updateLastEventId(uint64_t eventId);
    bool fileIsImage(NSString* path);
    void updateLastModificationDateForPath(NSString* path);
    NSDate* lastModificationDateForPath(NSString* path);
    QString qt_mac_NSStringToQString(const NSString* nsstr);
    private:
    NSFileManager* fm;
    IBOutlet NSTableView* table;
    NSMutableArray* images;
    NSMutableDictionary* pathModificationDates;
    NSDate* appStartedTimestamp;
    NSNumber* lastEventId;
    FSEventStreamRef stream;

    private:
    static FileSystemWatcherOSX* _instance;
    };

    @

    Can you help me ?
    Thank a lot.



  • Try to open it in a text editor which is able to display special characters. Sometimes it happens from coping code that you catch not displayable characters which cause such errors.


Log in to reply