小编Joe*_*Joe的帖子

C++ - 错误:'list'没有命名类型(列表对象作为类中的成员变量)

我一直在遇到"'xxx'没有命名类型"错误很多,我之前读过的大多数帖子都提到过这个错误会出现一些依赖性问题.但是,我似乎无法找到我的.这是我得到的:

GameLib.h

#ifndef GAMELIB_H_
#define GAMELIB_H_

//Structures
struct player_t {
    std::string name;
    int MMR;
};

//Prototypes
void* queueUpPlayer(void*);
int randomMMR();
std::string randomName();

#endif /* GAMELIB_H_ */
Run Code Online (Sandbox Code Playgroud)

PlayerGroup.h

#ifndef GROUP_H_
#define GROUP_H_

class playerGroup {
private:
    std::list<player_t> players;
    std::list<player_t>::iterator it;
    const int totalSize = 10;

public:
    //Constructor
    playerGroup();

    //Destructor
    ~playerGroup();

    //Add
    void add(const player_t p);

    ....
};

#endif /* GROUP_H_ */
Run Code Online (Sandbox Code Playgroud)

PlayerGroup.cpp

#include <iostream>
#include <cstdlib>
#include <string>
#include <cmath>
#include <list>

#include "GameLib.h"
#include "playerGroup.h"

using namespace std;

playerGroup::playerGroup() {} …
Run Code Online (Sandbox Code Playgroud)

c++ class stdlist

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

将H2数据库用于Flyway的Spring Test Profile

我正在尝试将端到端测试设置为使用内存数据库,该数据库可以轻松启动,关闭,擦除和填充测试数据。我正在做一个春季项目,并且正在使用flyway迁移数据库。当启动没有任何配置文件的spring服务器时,flyway可以正确运行迁移,一切都很好。但是,当在我的“测试”配置文件中运行时,不会运行飞行通道迁移。

application.properties

# Database Properties
spring.jpa.database=POSTGRESQL
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=validate
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb

# Data Rest Properties
spring.data.rest.basePath=/api

# Logging Properties
logging.level.root=WARN
logging.level.org.flywaydb=INFO
logging.level.com.myproj=INFO
Run Code Online (Sandbox Code Playgroud)

application-test.properties

# Server Properties
server.port=8081

# Database Properties
spring.jpa.database=H2
spring.database.driverClassName=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:mydb-test

# Dev Tools Properties
spring.devtools.restart.enabled=false

# Flyway Properties
flyway.locations=classpath:db/migration,classpath:db/test_seed_data
Run Code Online (Sandbox Code Playgroud)

这是使用测试配置文件启动spring服务器时得到的输出:

 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| …
Run Code Online (Sandbox Code Playgroud)

database spring h2 end-to-end flyway

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

标签 统计

c++ ×1

class ×1

database ×1

end-to-end ×1

flyway ×1

h2 ×1

spring ×1

stdlist ×1