小编chu*_*Dub的帖子

未解决的外部符号 - Qt创建者

我必须缺少一个带头文件的基本概念,因为当我尝试从单独的源文件调用最简单的函数时,我得到一个错误:

main.obj:-1:错误:LNK2019:函数_main中引用的未解析的外部符号"void __cdecl buildDeck(int,int)"(?buildDeck @@ YAXHH @ Z)

加入deck.h

#ifndef DECK_H
#define DECK_H
#include <QString>


void buildDeck(int deckSize, int jokers);


struct card
{
    QString suit;
    QString color;
    int rank;
};

#endif // DECK_H
Run Code Online (Sandbox Code Playgroud)

deck.cpp

#include"mainwindow.h"
#include "deck.h"

void buildDeck(int deckSize, int jokers)
{
    int blackRed = deckSize-=jokers;
}
Run Code Online (Sandbox Code Playgroud)

main.cpp中

#include "mainwindow.h"
#include "deck.h"
#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    buildDeck(10,20);

    return a.exec();
}
Run Code Online (Sandbox Code Playgroud)

这给了我一个错误.但是,如果我将函数定义从deck.cpp移动到main.cpp的底部,那么应用程序将构建.

所有文件都包含在同一个项目中,并存储在同一目录中.

其他文件:

.pro文件

QT       += core …
Run Code Online (Sandbox Code Playgroud)

c++ qt unresolved-external

25
推荐指数
1
解决办法
4万
查看次数

checked ="已检查"无法使用chrome

<input type="checkbox" name="Type[]" value="Red" checked="checked" /><span class="space-right">Red</span>
Run Code Online (Sandbox Code Playgroud)

正确设置复选框以在firefox和safari中检查但不是chrome.在网上找不到任何关于此的信息.

有人知道怎么修这个东西吗?

也试过裸体checked以及checked="true"

不是寻找js解决方案,谢谢.

编辑:下面的taco答案描述了问题所在.使用表单和输入元素时,元素必须正确嵌套在<td></td>标记中,否则checked="checked"无效.这是一个jsfiddle的例子,在chrome 29.0.1547.57上证明这是真的:http://jsfiddle.net/LnL7b/

html checkbox

22
推荐指数
2
解决办法
8万
查看次数

无法在CentOS上安装PDO

我知道在stackoverflow中有几个这个问题的实例,但我找不到解决方案.

我正在使用Apache和PHP 5.3运行CentOS

.php脚本给了我这个错误:

Fatal error: Class 'PDO' not found in ...
Run Code Online (Sandbox Code Playgroud)

我跑了phpinfo();,页面上唯一存在"pdo"的地方是"配置命令" '--disable-pdo'行.

我试过,#yum install php-pdo但没有包.

我也试过#pecl install pdo,我最后得到这些错误:

/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_instantiate':
/root/tmp/pear/PDO/pdo_dbh.c:410: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c:411: error: 'zval' has no member named 'is_ref'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_construct':
/root/tmp/pear/PDO/pdo_dbh.c:435: error: 'zend_fcall_info' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c:458: error: 'zend_fcall_info_cache' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'zim_PDO_setAttribute':
/root/tmp/pear/PDO/pdo_dbh.c:752: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c: …
Run Code Online (Sandbox Code Playgroud)

php mysql pdo centos

6
推荐指数
1
解决办法
1万
查看次数

PDF lib安装在Linux服务器上失败.使用pecl install pdflib

我正在尝试在我的服务器上安装pdflib并收到错误:

configure: error: pdflib.h not found! Check the path passed to --with-pdflib=<PATH>. PATH should be the install prefix directory. ERROR: /root/tmp/pear/pdflib/configure --with-pdflib=/usr/local' failed

我在终端输入以下内容:

pecl安装pdflib

path to pdflib installation? :

在/ usr /本地

linux terminal pecl pdflib

4
推荐指数
1
解决办法
8307
查看次数

Gmail API 服务帐户请求 - 前提条件检查失败

我第一次尝试使用 google API,当我尝试向 gmail API 发出请求时,出现“前提条件检查失败”错误。我使用的是服务帐户授权,而不是 Oauth2 用户同意。我尝试过的事情:

  1. 为服务帐户授权“域范围委派”。
  2. 确保该应用程序在 G Suite 帐户中受信任。
  3. 确保服务帐户角色是“所有者”
  4. 在 g suite 管理面板中为服务帐户的客户端 ID 启用了域范围委派。

这是来自 Node 客户端库的改编示例,但该示例未使用服务帐户身份验证,因此我无法直接使用该示例。

const path = require('path');
const {google} = require('googleapis');

const gmail = google.gmail('v1');

async function runSample() {
  // Obtain user credentials to use for the request
  const auth = new google.auth.GoogleAuth({
    keyFile: path.resolve(__dirname, 'google-key.json'),
    scopes: ['https://www.googleapis.com/auth/gmail.readonly'],
  });
  google.options({auth});

  const res = await gmail.users.messages.list({userId: 'me'}); // have tried with my gsuite email address as well
  console.log(res.data);
  return …
Run Code Online (Sandbox Code Playgroud)

gmail google-api node.js

4
推荐指数
1
解决办法
4855
查看次数

.htaccess 密码验证但允许 post 请求

我想用密码保护我的域,因为我只是用它来测试脚本,但我需要允许curl HTTP POST 请求。这可能吗?

当前.htaccess:

#AuthUserFile /home/domain/.htpasswds/.htpasswd
#AuthType Basic
#AuthName "Protected Domain"
#Require valid-user
Run Code Online (Sandbox Code Playgroud)

PHP 卷曲请求

    $handle = curl_init('http://wwww.domain.com/cgi/mailScript.php');
    curl_setopt($handle, CURLOPT_POST, 1);
    curl_setopt($handle, CURLOPT_POSTFIELDS, $serial);
    curl_exec($handle);
Run Code Online (Sandbox Code Playgroud)

PHP错误:

Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

Additionally, a 401 Authorization Required error was encountered while trying to use an ErrorDocument to handle the …
Run Code Online (Sandbox Code Playgroud)

.htaccess post curl

3
推荐指数
1
解决办法
3617
查看次数

Parsley.js 控制台错误

我以为我完全按照文档进行操作,但我不断收到错误。

Uncaught TypeError: Cannot read property 'fn' of undefined 
Run Code Online (Sandbox Code Playgroud)

指向 parsely.js 中的这个函数

 $.fn.parsley = function ( option, fn ) {
Run Code Online (Sandbox Code Playgroud)

然后当我单击提交按钮时,控制台显示

Uncaught TypeError: Object [object Object] has no method 'parsley' 
Run Code Online (Sandbox Code Playgroud)

这是我的表格

<html>
    <head>
        <script type="text/javascript" src="../GitProjects/Parsley.js/parsley.js"></script>
        <script src="../jquery.js" ></script>
        <link href="css/bootstrap.css" rel="stylesheet" />
    </head>
    <body>

<form id="demo-form" data-validate="parsley">
    <label for="fullname">Full Name * :</label>
    <input type="text" id="fullname" name="fullname" data-required="true" />

    <label for="email">Email * :</label>
    <input type="text" id="email" name="email" data-trigger="change" data-required="true" data-type="email" />

    <label for="website">Website :</label>
    <input type="text" id="website" name="website" data-trigger="change" data-type="url" …
Run Code Online (Sandbox Code Playgroud)

validation jquery parsley.js

3
推荐指数
1
解决办法
2万
查看次数

了解成员初始化列表

这是Qt mainwindow.cpp中自动生成的函数代码.

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

}
Run Code Online (Sandbox Code Playgroud)

这会是一回事吗?

MainWindow::MainWindow(QWidget *parent)
{
    QMainWindow = parent;
    ui = new Ui::MainWindow;
}
Run Code Online (Sandbox Code Playgroud)

c++ qt class

2
推荐指数
1
解决办法
170
查看次数

MySQL插入后触发更新行

我有2张桌子,RatingsRecipes.

插入后Ratings我需要找到额定配方的所有评级的平均值,并更新表格中的Rating_AvgRecipes.

这有效,但我相信它正在更新所有行,Recipes.Rating_Avg当我只需要更新Recipe_No =最近评级的Recipe_No的行.

CREATE TRIGGER `update_avg` AFTER INSERT ON `Ratings`
 FOR EACH ROW UPDATE Recipes
SET Rating_Avg = (SELECT AVG(Rating) from Ratings where Ratings.Recipe_No=Recipes.Recipe_No)
Run Code Online (Sandbox Code Playgroud)

我觉得我需要添加一个,WHERE Recipe_No = NEW.Recipe_No但我不知道在哪里添加它.

mysql triggers sql-update

2
推荐指数
1
解决办法
8948
查看次数

不允许成员函数重新声明

如果我在mainwindow.cpp中定义函数,该函数可以工作,但是当我在radiobuttons.cpp中定义它并尝试从mainwindow.cpp调用它时,项目将无法编译.

mainwindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H        
    #include <QMainWindow>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
        Q_OBJECT

        public:
            explicit MainWindow(QWidget *parent = 0);

            void build_radios();  //this function

            ~MainWindow();

    };    
#endif // MAINWINDOW_H
Run Code Online (Sandbox Code Playgroud)

radiobuttons.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

    void MainWindow::build_radios()
     {  

    //... some code

     }
Run Code Online (Sandbox Code Playgroud)

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

void MainWindow::radio_buttons();   //error: C2761: 'void MainWindow::build_radios(void)' : member function redeclaration not allowed

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)

{

radio_buttons();

}
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors

1
推荐指数
1
解决办法
1万
查看次数

在promise chain nodejs中传递数据

我有一系列承诺,第一个从API获取数据,第二个将数据插入数据库.

我试图将数据从第一个承诺传递到第二个承诺,但它是未定义的.

这是我的代码:

var getBalancePromise = function() {
  var promise = new Promise(function(resolve, reject) {
    poloniexExchange.getBalance({
      account: 'all'
    }, function(err, response) {
      if (err)
        console.log(err);
      reject(err);
      if (!err)
        resolve(response); //response is an array
    });
  }).catch((err) => {
    console.log('error');
  })
  return promise;

};

var updateBalancePromise = function(balanceArray) //balanceArray undefined. This should be the data from the first promise in the chain.
{
  var promise = new Promise(function(resolve, reject) {
    balanceArray.data.forEach(function(element) {
      db.collection('balances').update({
        currency: element.currency
      }, {
        $set: {
          amount: element.amount,
          shortname: …
Run Code Online (Sandbox Code Playgroud)

javascript node.js promise

0
推荐指数
1
解决办法
605
查看次数