我有我使用,使靜態庫3個小文件和應用程序:如何解決連接錯誤「找不到-lgcc_s」
test.h
#ifndef TEST_H
#define TEST_H
class Test
{
public:
Test();
};
extern Test* gpTest;
#endif
TEST.CPP
#include "test.h"
Test::Test()
{
gpTest = this;
}
Test test;
main.cpp中
#include "test.h"
#include <iostream>
using namespace std;
Test* gpTest = NULL;
int main()
{
return 0;
}
BUILD
g++ -c test.cpp -o test.o
ar cr test.a test.o
g++ -c main.cpp -o main.o
g++ main.o -o app -Wl,--whole-archive -L/home/dumindara/intest/test.a -Wl,-no--whole-archive
ERROR(聯工序)
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
我嘗試一切:使用-static-libgcc中和鏈接以靜態libstdC++。無法讓這個工作。這完全歸功於 - 整個歸檔標誌。但是我離不開它。
您似乎忘記了實際的錯誤信息? :) – 2010-10-08 07:18:17
:D。是的,忘記了錯誤。添加。 – nakiya 2010-10-08 07:20:30