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. MSVC2012 release w/o error, MSVC2010 with errors

MSVC2012 release w/o error, MSVC2010 with errors

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, I am trying to release one app with both - VS2010 and VS2012 compiler... App release and debug fine with VS2012, but with VS2010 it debugs fine but not also release... When trying to release it I get following errors

    error: C2143: syntax error : missing ',' before ':'
    error: C2530: 'f' : references must be initialized
    error: C2143: syntax error : missing ';' before '{'

    @void MainWindow::on_Playlist_clicked()
    {
    QString directory = QFileDialog::getExistingDirectory(this,tr("Select directory for files to import"),"C:/Users/x/Desktop/Filei");
    if(directory.isEmpty())
    return;
    QDir dir(directory);
    QStringList files = dir.entryList(QStringList() << "*.mp3",QDir::Files);
    QList<QMediaContent> content;
    for(const QString& f:files)
    {
    content.push_back(QUrl::fromLocalFile(dir.path()+"/" + f));
    QFileInfo fi(f);
    ui->listWidget1->addItem(fi.fileName());
    }
    ui->listWidget1->setCurrentRow(playlist->currentIndex() != -1? playlist->currentIndex():0);
    //ui->listWidget->setDragDropMode(QAbstractItemView::InternalMove);
    playlist->addMedia(content);

    }@

    I don't really understand why same application compile with VS2012 fine but not also with VS2010.. Its same source code, I tried qmake, cleaned project,.... nothing helped so far...

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      [quote author="Anonymous" date="1381575602"]
      @
      for(const QString& f:files)
      @
      [/quote]Range-based for loops are a new feature of C++11, which was released in 2011. VS 2010 doesn't support it properly.

      Rewrite it using a traditional loop and the error should go away.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Okay, thanks...

        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