【发布时间】:2018-12-27 09:30:57
【问题描述】:
我在 Cygwin 的 Windows 7 下安装了 SystemC (2.3.2) 和 SystemC-AMS (2.1),没有出现以下问题:
./configure --with-systemc=/home/user/Workspace/systemc-2.3.2
make
make install
然后我进入 Eclipse (Photon - 4.8.0) 并创建了一个新的 C/C++ 项目。对于工具链,我选择了Cygwin GCC。此外,我在项目中应用了以下设置:
包含路径:
"C:\cygwin64\home\user\Workspace\systemc-2.3.2\include"
"C:\cygwin64\home\user\Workspace\systemc-ams-2.1\include"
图书馆搜索路径:
"C:\cygwin64\home\user\Workspace\systemc-2.3.2\lib-cygwin64"
"C:\cygwin64\home\user\Workspace\systemc-ams-2.1\lib-cygwin64"
图书馆:
systemc
systemc-ams
现在我尝试执行以下代码:
#include <iostream>
#include "systemc.h"
#include "systemc-ams.h"
int sc_main (int argc, char* argv[])
{
std::cout << "Hello World" << std::endl;
sca_tdf::sca_signal <double> out1;
return 0;
}
我得到一个未定义的引用错误:
11:36:35 **** Incremental Build of configuration Debug for project SystemC-AMS-Test ****
make all
Building file: ../TestSCAMS.cpp
Invoking: Cygwin C++ Compiler
g++ -I"C:\cygwin64\home\user\Workspace\systemc-2.3.2\include" -I"C:\cygwin64\home\user\Workspace\systemc-ams-2.1\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"TestSCAMS.d" -MT"TestSCAMS.o" -o "TestSCAMS.o" "../TestSCAMS.cpp"
Finished building: ../TestSCAMS.cpp
Building target: SystemC-AMS-Test.exe
Invoking: Cygwin C++ Linker
g++ -L"C:\cygwin64\home\user\Workspace\systemc-2.3.2\lib-cygwin64" -L"C:\cygwin64\home\user\Workspace\systemc-ams-2.1\lib-cygwin64" -o "SystemC-AMS-Test.exe" ./TestSCAMS.o -lsystemc -lsystemc-ams
C:\cygwin64\home\user\Workspace\systemc-ams-2.1\lib-cygwin64/libsystemc-ams.a(convert_from_string.o):convert_from_string.cpp:(.text$_ZN8sca_util18sca_implementation18convert_by_istreamIN5sc_dt8sc_logicEEEbRT_RKSs[_ZN8sca_util18sca_implementation18convert_by_istreamIN5sc_dt8sc_logicEEEbRT_RKSs]+0x18f): undefined reference to `sc_dt::sc_logic::scan(std::istream&)'
C:\cygwin64\home\user\Workspace\systemc-ams-2.1\lib-cygwin64/libsystemc-ams.a(convert_from_string.o):convert_from_string.cpp:(.text$_ZN8sca_util18sca_implementation18convert_by_istreamIN5sc_dt8sc_logicEEEbRT_RKSs[_ZN8sca_util18sca_implementation18convert_by_istreamIN5sc_dt8sc_logicEEEbRT_RKSs]+0x18f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `sc_dt::sc_logic::scan(std::istream&)'
collect2: error: ld returned 1 exit status
make: *** [makefile:46: SystemC-AMS-Test.exe] Error 1
11:36:38 Build Failed. 1 errors, 0 warnings. (took 3s.199ms)
这可能是什么问题?
【问题讨论】:
-
make install将标头和共享库放在哪里? -
C:\cygwin64\home\user\Workspace\systemc-2.3.2\lib-cygwin64 C:\cygwin64\home\user\Workspace\systemc-ams-2.1\lib-cygwin64 在那些路径有 libsystemc.a 和 libsystemc-ams.a
-
将路径从 windows 样式
"C:\cygwin64\home\user\Workspace\systemc-2.3.2\include"更改为 posix"/home/user/Workspace/systemc-2.3.2/include" -
和以前一样的问题,所以编译工作,但是链接会抛出如上所示的错误。
-
尝试将“-lsystemc -lsystemc-ams”的顺序颠倒为“-lsystemc-ams -lsystemc”