- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试将 H2 数据库与 sprint junit 测试一起使用,如下所示:
1- SpringTestingConfig:
@Configuration
@ComponentScan(basePackages = "com.myapp.data", excludeFilters = { @Filter(Configuration.class) })
@PropertySource("classpath:/test.properties")
@Profile("test")
public class SpringTestingConfig {
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:mem:test;MODE=Mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS TEST");
dataSource.setUsername("sa");
dataSource.setPassword("");
return dataSource;
}
}
2- MyTestClass:
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ WebContextTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class,
DirtiesContextTestExecutionListener.class,
TransactionalTestExecutionListener.class })
@ActiveProfiles("test")
@DirtiesContext
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {
SpringConfig.class, SpringTestingConfig.class,
SpringLocalContainerJPAConfig.class, CustomConfiguration.class })
public class MyTestClass{
}
我的数据库表是在运行时使用 hibernate 创建的,当我尝试运行测试时出现以下异常:
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [/* select generatedAlias0 from User as generatedAlias0 */ select user0_.id as id1_8_, user0_.jpa_version as jpa2_8_, user0_.AccountActivated as AccountA3_8_, user0_.AccountActivationDate as AccountA4_8_, user0_.IsAdmin as IsAdmin5_8_, user0_.Bio as Bio6_8_, user0_.birthMonth as birthMon7_8_, user0_.CashGivingBalance as CashGivi8_8_, user0_.CashReceivedBalance as CashRece9_8_, user0_.CompanyGID as Company28_8_, user0_.AccountCreatedDate as Account10_8_, user0_.dayOfBirthday as dayOfBi11_8_, user0_.DeletionWarningDate as Deletio12_8_, user0_.Dept as Dept13_8_, user0_.Email as Email14_8_, user0_.FirstName as FirstNa15_8_, user0_.HireDate as HireDat16_8_, user0_.is_active as is17_8_, user0_.LastLogin as LastLog18_8_, user0_.LastName as LastNam19_8_, user0_.LastSatisfactionSurveyDate as LastSat20_8_, user0_.Locale as Locale21_8_, user0_.MPath as MPath22_8_, user0_.MTDRewards as MTDRewa23_8_, user0_.Password as Passwor24_8_, user0_.PersonalityType as Persona25_8_, user0_.Title as Title26_8_, user0_.YTDRewards as YTDRewa27_8_ from myapp.User user0_]; SQL state [90079]; error code [90079]; could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare statement
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:651)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy79.deleteAll(Unknown Source)
at test.myapp.web.controllers.SignUpBeanTest.before(SignUpBeanTest.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:188)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:159)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1854)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1831)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811)
at org.hibernate.loader.Loader.doQuery(Loader.java:899)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2516)
at org.hibernate.loader.Loader.doList(Loader.java:2502)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
at org.hibernate.loader.Loader.list(Loader.java:2327)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:254)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:247)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.deleteAll(SimpleJpaRepository.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
... 36 more
Caused by: org.h2.jdbc.JdbcSQLException: Schema "MYAPP" not found; SQL statement:
/* select generatedAlias0 from User as generatedAlias0 */ select user0_.id as id1_8_, user0_.jpa_version as jpa2_8_, user0_.AccountActivated as AccountA3_8_, user0_.AccountActivationDate as AccountA4_8_, user0_.IsAdmin as IsAdmin5_8_, user0_.Bio as Bio6_8_, user0_.birthMonth as birthMon7_8_, user0_.CashGivingBalance as CashGivi8_8_, user0_.CashReceivedBalance as CashRece9_8_, user0_.CompanyGID as Company28_8_, user0_.AccountCreatedDate as Account10_8_, user0_.dayOfBirthday as dayOfBi11_8_, user0_.DeletionWarningDate as Deletio12_8_, user0_.Dept as Dept13_8_, user0_.Email as Email14_8_, user0_.FirstName as FirstNa15_8_, user0_.HireDate as HireDat16_8_, user0_.is_active as is17_8_, user0_.LastLogin as LastLog18_8_, user0_.LastName as LastNam19_8_, user0_.LastSatisfactionSurveyDate as LastSat20_8_, user0_.Locale as Locale21_8_, user0_.MPath as MPath22_8_, user0_.MTDRewards as MTDRewa23_8_, user0_.Password as Passwor24_8_, user0_.PersonalityType as Persona25_8_, user0_.Title as Title26_8_, user0_.YTDRewards as YTDRewa27_8_ from myapp.User user0_ [90079-172]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.command.Parser.getSchema(Parser.java:613)
at org.h2.command.Parser.getSchema(Parser.java:620)
at org.h2.command.Parser.readTableFilter(Parser.java:1067)
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1705)
at org.h2.command.Parser.parseSelectSimple(Parser.java:1813)
at org.h2.command.Parser.parseSelectSub(Parser.java:1699)
at org.h2.command.Parser.parseSelectUnion(Parser.java:1542)
at org.h2.command.Parser.parseSelect(Parser.java:1530)
at org.h2.command.Parser.parsePrepared(Parser.java:405)
at org.h2.command.Parser.parse(Parser.java:279)
at org.h2.command.Parser.parse(Parser.java:251)
at org.h2.command.Parser.prepareCommand(Parser.java:218)
at org.h2.engine.Session.prepareLocal(Session.java:425)
at org.h2.engine.Session.prepareCommand(Session.java:374)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:70)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:267)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:161)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182)
... 67 more
在异常发生之前,我在创建数据库时得到以下日志:
14:04:20.043 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table myapp.CashReceiving (id varchar(36) not null, jpa_version bigint, amount integer not null, AmountBalance integer not null, AmountRedeemed integer not null, Comments integer, CompanyValueGID varchar(255), EntryDate datetime not null, Likes integer, Note varchar(255), CompanyGID varchar(36) not null, fromUserGID varchar(36), toUserGID varchar(36) not null, primary key (id)) ENGINE=InnoDB
14:04:20.044 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000388: Unsuccessful: create table myapp.CashReceiving (id varchar(36) not null, jpa_version bigint, amount integer not null, AmountBalance integer not null, AmountRedeemed integer not null, Comments integer, CompanyValueGID varchar(255), EntryDate datetime not null, Likes integer, Note varchar(255), CompanyGID varchar(36) not null, fromUserGID varchar(36), toUserGID varchar(36) not null, primary key (id)) ENGINE=InnoDB
14:04:20.044 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Schema "MYAPP" not found; SQL statement:
14:04:22.353 [main] DEBUG org.hibernate.hql.internal.ast.ErrorCounter - throwQueryException() : no errors
14:04:22.353 [main] DEBUG org.hibernate.hql.internal.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
14:04:22.354 [main] DEBUG org.hibernate.hql.internal.ast.tree.FromElement - FromClause{level=1} : com.myapp.data.domain.User (generatedAlias0) -> user0_
14:04:22.354 [main] DEBUG org.hibernate.hql.internal.ast.tree.FromReferenceNode - Resolved : generatedAlias0 -> user0_.id
14:04:22.354 [main] DEBUG org.hibernate.hql.internal.antlr.HqlSqlBaseWalker - select : finishing up [level=1, statement=select]
14:04:22.354 [main] DEBUG org.hibernate.hql.internal.ast.HqlSqlWalker - processQuery() : ( SELECT ( {select clause} user0_.id ) ( FromClause{level=1} myapp.User user0_ ) )
14:04:22.355 [main] DEBUG org.hibernate.hql.internal.ast.util.JoinProcessor - Using FROM fragment [myapp.User user0_]
14:04:22.356 [main] DEBUG org.hibernate.hql.internal.antlr.HqlSqlBaseWalker - select >> end [level=1, statement=select]
14:04:22.356 [main] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - --- SQL AST ---
请告知如何解决此异常。
更新:在我的 test.properties 中我有以下键
hibernate.default_schema=Test
JPA 配置
@Configuration
@EnableSpringConfigured
public class SpringJNDIJPAConfig {
protected static final Logger logger = LoggerFactory.getLogger(SpringConfig.class);
protected static final String HIBERNATE_TRANSACTION_JTA_PLATFORM = "hibernate.transaction.jta.platform";
@Value("${hibernate.naming_strategy:org.hibernate.cfg.DefaultNamingStrategy}")
private String namingStrategy;
@Value("${hibernate.packages_to_scan:com.myapp.data.domain}")
private String packagesToScan;
@Value("${spring_config.project_name}")
private String projectName;
@Value("${hibernate.show_sql:false}")
private String showSql;
@Value("${hibernate.hbm2ddl.auto:update}")
private String hbm2ddlAuto;
@Value("${hibernate.format_sql:false}")
private String formatSql;
@Value("${hibernate.dialect:org.hibernate.dialect.MySQL5InnoDBDialect}")
private String hibernateDialect;
@Value("${hibernate.connection.useUnicode:true}")
private String useUnicode;
@Value("${hibernate.connection.characterEncoding:UTF-8}")
private String characterEncoding;
@Value("${hibernate.charSet:UTF-8}")
private String charSet;
@Value("${hibernate.default_schema:myapp}")
private String defaultSchema;
@Value("${hibernate.use_default_schema:true}")
private boolean useDefaultSchema;
@Value("${hibernate.use_sql_comments:true}")
private String useSqlComments;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private DataSource dataSource;
@Bean
public HibernateExceptionTranslator hibernateExceptionTranslator() {
return new HibernateExceptionTranslator();
}
@Bean
protected EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
JtaPersistenceUnitManager puManager = new JtaPersistenceUnitManager();
Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
dataSources.put("dataSource", dataSource);
puManager.setDataSourceLookup(new MapDataSourceLookup(dataSources));
puManager.setDefaultDataSource(dataSource);
puManager.setPackagesToScan(packagesToScan());
bean.setPersistenceUnitManager(puManager);
bean.setPersistenceProviderClass(HibernatePersistence.class);
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
Properties jpaProperties = getHibernateProperties();
jpaProperties.put(HIBERNATE_TRANSACTION_JTA_PLATFORM, SpringJtaPlatform.class.getName().toString());
bean.setJpaProperties(jpaProperties);
puManager.afterPropertiesSet();
bean.afterPropertiesSet();
return bean.getObject();
}
protected String getDefaultSchema() {
String ds = ConfigurationUtil.config().getString("db.schema.name");
if (ds != null) defaultSchema = ds;
return defaultSchema;
}
protected String getUseUnicode() {
return useUnicode;
}
protected String getCharacterEncoding() {
return characterEncoding;
}
protected String getCharSet() {
return charSet;
}
protected String getFormatSql() {
return formatSql;
}
protected String getHbm2ddlAuto() {
return hbm2ddlAuto;
}
protected String getHibernateDialect() {
return hibernateDialect;
}
protected Properties getHibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", getHibernateDialect());
properties.put("hibernate.hbm2ddl.auto", getHbm2ddlAuto());
properties.put("hibernate.show_sql", getShowSql());
properties.put("hibernate.use_sql_comments", getUseSqlComments());
properties.put("hibernate.format_sql", getFormatSql());
if(useDefaultSchema) {
properties.put("hibernate.default_schema", getDefaultSchema());
}
//properties.put("hibernate.ejb.naming_strategy", namingStrategy);
properties.put("hibernate.hbm2ddl.import_files", "/import.sql");
//properties.put("hibernate.connection.characterEncoding", getCharacterEncoding());
//properties.put("hibernate.connection.charSet", getCharSet());
//properties.put("hibernate.connection.useUnicode", getUseUnicode());
if(logger.isInfoEnabled()) {
logger.info(MessageFormat.format("SET HIBERNATE PROPERTIES: {0}", properties.toString()));
}
return properties;
}
protected String getProjectName() {
return projectName;
}
protected String getShowSql() {
return showSql;
}
protected String getUseSqlComments() {
return useSqlComments;
}
protected String packagesToScan() {
return packagesToScan;
}
@Bean
protected JtaTransactionManager transactionManager() {
SpringBeanFactory.setApplicationContext(applicationContext);
JtaTransactionManager manager = new JtaTransactionManager();
manager.setTransactionManagerName("java:jboss/TransactionManager");
manager.setUserTransactionName("java:jboss/UserTransaction");
manager.afterPropertiesSet();
return manager;
}
}
最佳答案
在你的 SQL 中,你有
from myapp.User user0_
不应该吗
from TEST.User user0_ ?
修复它替换:
@Value("${hibernate.default_schema:myapp}")
private String defaultSchema;
与
@Value("${hibernate.default_schema}")
private String defaultSchema;
并使用:
dataSource.setUrl("jdbc:h2:mem:test;MODE=Mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS MYAPP");
希望对你有帮助
关于java - org.h2.jdbc.JdbcSQL异常 : Schema "MYAPP" not found; SQL statement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17879265/
我尝试在安装了多类型 MFC 库的 visual studio 2015 MFC 上运行以前编写的 MFC c++ 代码。 但是,我这里仍然有 12 个关于缺少函数的错误: IntelliSense:
我正在学习 OOP 并且有疑问。假设我有一个包含 ClassB.h 的文件 ClassA.h,并且在某些时候我的 ClassB.h 需要包含 ClassA .h。 这会产生一个错误,我想我明白为什么会
我开始使用 CUDA 进行编程,在一些示例中我找到了包含文件 cuda.h、cuda_runtime.h 和 cuda_runtime_api.h 包含在代码中。有人可以向我解释一下这些文件之间的区别
我有一些生成正则表达式的代码。那么下面的表达式实际上是: ^(?:\s*((exclude|include|hide|show|protect|risk|dir-merge|merge)),\s*((
我一直在查看一些源代码,以更好地了解我们使用的这款游戏的核心,并编写更可靠、更快速的插件。然后我发现了这段奇怪的代码...... public void setMaxH(double amount)
通常我们会使用标准类型作为 std::unordered_map 的键和值.但现在我需要自定义我自己的键和值类。 键类在block_cache_key.h 中定义如下: #ifndef BLOCK_C
例如,我想要两个头文件,它们可以依赖于另一个头文件中的函数。 //Header1.h file #include Header2.h void h1(){ //... func1(); } v
我正在研究来自 Sedgewick 的 Shell 排序 Algorithms in C part 1-4在第 172 页。 我使用 size (数组的长度),而不是 l和 r (开始和结束);所以我
我在 macOS BigSur 上通过 VMWare 使用 Ubuntu 20.04.2 LTS。我安装了最新版本的 tcl、tcl-dev、tk 和 tk-dev - 版本 8.6。我想编译 Arc
我用我的 glu 和 gl 头文件构建了一个 OpenGL 程序,默认包含在 windows 7 专业版中。现在,我买了一本描述 OpenGL 游戏开发的书。这本书的作者说,我必须在我的项目中包含 g
我想在 token 中保留特殊字符,同时仍对特殊字符进行 token 化。说我有话 "H&R Blocks" 我想将其标记为 "H", "R", "H&R", "Blocks" 我读了http://w
关于 hash 作为 trans 参数的另一个问题。在下面的代码中,简单地使用 hash 会给出不正确的结果,但是将其替换为 keys 和 values 会使其正确。怎么了? my @alph1 =
我已经编写了一个 C 程序,它获取屏幕像素的 RGB 值 (0-255),并知道其位置 (x,y)。它可以在 Linux 中运行,但是当我尝试在 Visual Studio (Windows) 中编译
我已经使用 Windows 7 专业版中默认包含的 glu 和 gl 头文件构建了一个 OpenGL 程序。现在,我买了一本描述 OpenGL 游戏开发的书。这本书的作者说,我必须将glew head
#include using namespace std; #include //#include int main() { initscr();
h:messages h:form 内的组件还显示与外部组件相关的消息。 如何限制它只显示与包含 h:form 内的组件相关的消息? 我不喜欢用单独的h:message来使我的代码膨胀。每个输入组件的
我下载了示例代码和 cpp 文件,其中包含 list.h、queue.h 和 vector.h 等头文件,如果我尝试构建,我会收到“ fatal error :没有这样的文件或目录编译终止”我想我应该
我有一个编译成功的桌面项目,但是在我向项目添加新配置以支持 Windows Mobile 平台后,我收到以下错误: error C2146: syntax error : missing ';' be
有很多关于这个错误的帖子,但我无法解决它,我希望你能拿出解决方案。我在 Ubuntu 机器上。 ~/graphmap2$ 在这个文件夹中,我下载了 zlib。可以看图 经过一番谷歌搜索后,我还注意到没
是否可以在 Visual C++ 中使用以下 header : 图.h dos.h bios.h 最佳答案 据我所知,无法在 Visual C++ 中使用它, 与此同时,我希望您关注 Open Wat
我是一名优秀的程序员,十分优秀!