我正在尝试编译其他人的项目。我已经设法在Windows下构建它,这意味着它可以编译,但现在我在Linux上苦苦挣扎。具体来说,我收到一个文件的错误:
#ifndef _LOGGER_H_2011_27_02_
#define _LOGGER_H_2011_27_02_
// logger
#include <log4cplus/logger.h>
#include <iomanip>
#define LOG_TRACE(logger, msg) LOG4CPLUS_TRACE(logger, \
"[@" << std::hex << (size_t)this << "] " << std::dec << msg);
#define LOG_DEBUG(logger, msg) LOG4CPLUS_DEBUG(logger, \
"[@" << std::hex << (size_t)this << "] " << std::dec << msg);
// I erased repetitive declarations for WARN, FATAl etc...
代码本身对我没有意义,表达式"[@" <<
有点狂野,但无关紧要,它应该编译。我得到的错误是:
source/repository/../query/../loader/../common/logger.h:30:64: error: ‘LOG4CPLUS_ERROR’ was not declared in this scope
"[@" << std::hex << (size_t)this << "] " << std::dec << msg);
还有:
source/repository/Repository.cpp: In member function ‘void W3TTServer::Repository::cleanupSessions()’:
source/repository/Repository.cpp:82:64: error: invalid operands of types ‘const char [33]’ and ‘long int’ to binary ‘operator<<’
LOG4CPLUS_TRACE(logger, "Cleaning up inactive sessions..." << sessionCleanupTimer);
我启用了详细模式,但这是一个笑话,实际上,我得到的只是包含目录的列表:
#include <...> search starts here:
/usr/local/ssl/include
/usr/include/c++/4.9
/usr/include/x86_64-linux-gnu/c++/4.9
/usr/include/c++/4.9/backward
/usr/lib/gcc/x86_64-linux-gnu/4.9/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
log4cplus库安装在/usr/include/log4cplus/
中,由于没有关于丢失头文件的错误,我认为<log4cplus/logger.h>
加载得很好。为了验证这一点,我需要一个包含文件的列表来查看位置是否正确。
如何在GCC中获取包含文件的列表?
答案 0 :(得分:3)
将-H
(preprocessor) option传递给g++
,通常在Makefile
添加CXXFLAGS += -H
,例如Makefile
。加入
make CXX='g++ -H -Wall'
在g++
您可以在终端上尝试-H
。
如果您在终端中输入tblDataSet.Tables.Add(Table_c);
,请在其后添加private DataTable Table_c; // Table_c is imported from a local database
private DataTable Table_a; // Table_a is imported from a local database
private DataSet tblDataSet;
private void Form1_Load(object sender, EventArgs e)
{
this.table_aTableAdapter1.Fill(this.DBDataSet1.Table_a);
this.table_cTableAdapter.Fill(this.DBDataSet1.Table_c);
tblDataSet = new DataSet();
tblDataSet.Tables.Add(Table_c);
tblDataSet.Tables.Add(Table_a);
tblDataSet.Relations.Add("Relation1",
Table_c.Columns["Number"], Table_a.Columns["Number"]);
BindingSource bsC = new BindingSource();
bsC.DataSource = tblDataSet;
bsC.DataMember = "Table_c";
BindingSource bsA = new BindingSource();
bsA.DataSource = bsC;
bsA.DataMember = "Relation1";
table_cDataGridView.DataSource = bsC;
table_aDataGridView.DataSource = bsA;
}
。