小编Kiv*_*360的帖子

G ++未定义对class :: function的引用

我终于非常绝望了.所以,在我的c ++类中,我们被指示使用类.我们有头文件声明类和函数,而单独的.cpp文件实现它.事情应该是有效的,但它们不是,网络上的任何解决方案似乎都不适合我.我在linux上使用G ++编译器,它似乎无法在IDE或普通命令行上运行.

我在TBook.h中遇到的错误是这样的:

/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccxqI6An.o: In function `TBook::TBook()':
TBook.cpp:(.text+0x3b): undefined reference to `Telephone::Telephone()'
TBook.cpp:(.text+0x100): undefined reference to `Telephone::Telephone()'
TBook.cpp:(.text+0x132): undefined reference to `Telephone::allNum(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
TBook.cpp:(.text+0x182): undefined reference to `Telephone::~Telephone()'
TBook.cpp:(.text+0x191): undefined reference to `Telephone::~Telephone()'
TBook.cpp:(.text+0x2b3): undefined reference to `Telephone::~Telephone()'
TBook.cpp:(.text+0x2e6): undefined reference to `Telephone::~Telephone()'
TBook.cpp:(.text+0x2fa): undefined reference to `Telephone::~Telephone()'
/tmp/ccxqI6An.o:TBook.cpp:(.text+0x370): more undefined references to `Telephone::~Telephone()' follow
/tmp/ccxqI6An.o: In function `TBook::write()':
TBook.cpp:(.text+0x4e1): undefined reference to `Telephone::getNumber()'
TBook.cpp:(.text+0x506): undefined reference to …
Run Code Online (Sandbox Code Playgroud)

c++ linux compiler-construction g++ class

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

使用Passport-local的电子邮件.以前的帮助不起作用

所以我使用passport-local和express来处理用户登录.到目前为止,我已经能够在使用用户名时成功登录,但是用户名很难记住,我个人认为它们不应该用于处理用户,因此我尝试修改护照上提供的示例策略 - 本地页面通过电子邮件确认用户,但代码不起作用.

我对电子邮件的策略是:

passport.use(new LocalStrategy(function(email, password, done) {
  User.findOne({ email: email }, {}, function(err, user) {
    if (err) { return done(err); }
    if (!user) { return done(null, false, { message: 'Unknown user ' + e }); }
    user.comparePassword(password, function(err, isMatch) {
      if (err) return done(err);
      if(isMatch) {
        return done(null, user);
      } else {
        return done(null, false, { message: 'Invalid password' });
      }
    });
  });
}));
Run Code Online (Sandbox Code Playgroud)

它来自这个策略:

//The login strategy
passport.use(new LocalStrategy(function(username, password, done) {
  User.findOne({ username: username }, function(err, …
Run Code Online (Sandbox Code Playgroud)

javascript authentication express passport.js

12
推荐指数
2
解决办法
8039
查看次数

玉缩进错误

所以对于我的Express网站,我正在使用玉.所以我决定尝试修改我的布局文件,以便开始设计我的网站.我修改了原始布局代码(有效),但我开始在任何扩展布局的文件中得到缩进错误,如下所示:

500 Error: /home/kevin/Blue/views/layout.jade:6 4| p Hello World Invalid indentation, you can use tabs or spaces but not both
4| p Hello World
Invalid indentation, you can use tabs or spaces but not both
at Object.Lexer.indent (/home/kevin/Blue/node_modules/jade/lib/lexer.js:679:15)
at Object.Lexer.next (/home/kevin/Blue/node_modules/jade/lib/lexer.js:777:15)
at Object.Lexer.lookahead (/home/kevin/Blue/node_modules/jade/lib/lexer.js:107:46)
at Object.Parser.lookahead (/home/kevin/Blue/node_modules/jade/lib/parser.js:115:23)
at Object.Parser.peek (/home/kevin/Blue/node_modules/jade/lib/parser.js:92:17)
at Object.Parser.tag (/home/kevin/Blue/node_modules/jade/lib/parser.js:640:22)
at Object.Parser.parseTag (/home/kevin/Blue/node_modules/jade/lib/parser.js:624:17)
at Object.Parser.parseExpr (/home/kevin/Blue/node_modules/jade/lib/parser.js:198:21)
at Object.Parser.block (/home/kevin/Blue/node_modules/jade/lib/parser.js:592:25)
at Object.Parser.tag (/home/kevin/Blue/node_modules/jade/lib/parser.js:721:26)
Run Code Online (Sandbox Code Playgroud)

所以我的代码是这样的:

index.jade

extends layout

block content
    p Hello World
Run Code Online (Sandbox Code Playgroud)

doctype 5
html
  head
    title= title …
Run Code Online (Sandbox Code Playgroud)

javascript indentation express sublimetext2 pug

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