• 締切済み

g++ エラーについて。

linux初心者です。 linux で下記を実行したのですが、 -----------------------------------------------------------  $ g++ -o exampleX exampleX.cpp `pkg-config libvmime` ----------------------------------------------------------- 下記のようなエラーが出ています。 何が悪いのか、ヒント等ご教授お願い致します。 ----------------------------------------------------------- /tmp/ccY1vj5D.o(.gnu.linkonce.t._ZN5vmime8platform10setHandlerINS_9platforms5posix12posixHandlerEEEvv+0x1e): In function `void vmime::platform::setHandler<vmime::platforms::posix::posixHandler>()': : undefined reference to `vmime::platform::sm_handler' (省略) collect2: ld はステータス 1 で終了しました -----------------------------------------------------------

みんなの回答

  • potkurin
  • ベストアンサー率24% (33/134)
回答No.1

似たような御質問が過去に別掲示板であったようですね。 http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=16994&forum=10&6

hanna2007
質問者

補足

今回の場合は、 ここ↓に、  `void vmime::platform::setHandler<vmime::platforms::posix::posixHandler>()': この↓宣言が通っていないというエラーでしょうか?  `vmime::platform::sm_handler'

全文を見る
すると、全ての回答が全文表示されます。

関連するQ&A

  • Cppunitのビルドエラー解消

    お世話になります。 Cppunitでテストケースを作成し、ビルドしようとしておりますが、ビルドをすることができません。 ・以下がエラーログの抜粋ですが、「TestRunnerClient.o:TestRunnerClient.cpp:~」の行がEclipse上で赤く表示されており、原因だと思われます。基本的な質問で恐縮ですが、エラーの解消方法をご存知の方がおられればご教示頂けると助かります。 ・プロジェクトのライブラリ指定は添付の画像のようにしております。この部分の指定に誤りはございませんでしょうか。 d000000.o:(.idata$2+0x0): multiple definition of `_head_libcppunit_1_12_1_dll' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d000387.o):(.idata$2+0x0): first defined here d000001.o:(.idata$5+0x0): multiple definition of `_imp___ZTVN7CppUnit27TestSuiteBuilderContextBaseE' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001116.o):(.idata$5+0x0): first defined here d000001.o:(.idata$6+0x0): multiple definition of `_nm___ZTVN7CppUnit27TestSuiteBuilderContextBaseE' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001116.o):(.idata$6+0x0): first defined here d000002.o:(.idata$7+0x0): multiple definition of `libcppunit_1_12_1_dll_iname' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001147.o):(.idata$7+0x0): first defined here TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x34f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x375): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x54f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x575): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x99d): undefined reference to `gethostname@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x9e8): undefined reference to `gethostname@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa4b): undefined reference to `WSAStartup@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa7f): undefined reference to `socket@12' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa9b): undefined reference to `gethostbyname@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xae8): undefined reference to `htons@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xb3b): undefined reference to `connect@12' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xbac): undefined reference to `select@20' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x121e): undefined reference to `closesocket@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x1226): undefined reference to `WSACleanup@0' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x138e): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x13b4): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x23ff): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x2425): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x358f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x35b5): more undefined references to `send@16' follow TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x3a7a): undefined reference to `select@20' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: TestRunnerClient.o: bad reloc address 0x2 in section `.text$_ZN7CppUnit12TestListenerD1Ev[__ZN7CppUnit12TestListenerD1Ev]'

  • MinGWのg++で分割コンパイルエラー

    MinGW環境でC++の勉強を始めました。 簡単なサンプルのコンパイルをしてみたのですが、ソースファイルを一括してコンパイルすると問題ないのですが、個別にコンパイルしようとするとエラーがでてしまいまいます。 原因や対処法をご存じの方がいらっしゃいましたらご教示下さい。 一括でコンパイルすると問題なし bash-3.1$ g++ -Wl,--enable-auto-import main.cpp point.cpp -lstdc++ 個別にコンパイルしようとした場合 bash-3.1$ g++ -Wl,--enable-auto-import -o main.o main.cpp C:\DOCUME~1\user\LOCALS~1\Temp\ccZrVmLp.o:main.cpp:(.text+0x16): undefined reference to `Point::Point()' C:\DOCUME~1\user\LOCALS~1\Temp\ccZrVmLp.o:main.cpp:(.text+0x32): undefined reference to `Point::Point(int, int)' C:\DOCUME~1\user\LOCALS~1\Temp\ccZrVmLp.o:main.cpp:(.text+0x3e): undefined reference to `Point::println()' C:\DOCUME~1\user\LOCALS~1\Temp\ccZrVmLp.o:main.cpp:(.text+0x4a): undefined reference to `Point::println()' collect2: ld returned 1 exit status ※ -Wl,--enable-auto-importは、他の警告を消すために入れました、無くても質問の問題に変化はありませんでした。 サンプルソース ---main.cpp--- #include<iostream> #include "point.h" using namespace std; int main(){ Point p1,p2(4,5); p1.println(); p2.println(); return 0; } ----------- ---point.h--- class Point { private: int x, y; static int count; public: Point(); Point( int, int ); void set( int, int ); void println(); }; ------------- ---point.cpp--- #include<iostream> #include"point.h" using namespace std; int Point::count; Point::Point(){ this->x = this->y = 0; ++count; } Point::Point(int ax, int ay){ this->x = ax; this->y = ay; ++count; } void Point::set( int ax, int ay ){ this->x = ax; this->y = ay; } void Point::println(){ cout << "Point(" << x << "," << y << ")" << endl; } ----------- bash-3.1$ g++ -v Using built-in specs. COLLECT_GCC=D:\MinGW\bin\g++.exe COLLECT_LTO_WRAPPER=d:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.5.0/configure --enable-languages=c,c++,ada,fortran,obj c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r untime-libs --disable-werror --build=mingw32 --pref

  • エラーが改善できません。

    C:\__Home\Visual Studio 2008\Projects\fecgsepfast>make MAKE Version 5.2 Copyright (c) 1987, 2000 Borland g++ -o fecgsep -O3 -lm ./src/fecgsep.cpp ./src/mem_util.cpp -L ./ -lica_ dll_amd ./src/fecgsep.cpp: In function 'int main(int, char**)': ./src/fecgsep.cpp:245:22: warning: name lookup of 'i' changed ./src/fecgsep.cpp:28:9: warning: matches this 'i' under ISO standard rules ./src/fecgsep.cpp:203:17: warning: matches this 'i' under old rules C:\DOCUME~1\Wada\LOCALS~1\Temp\cc6RcquX.o:fecgsep.cpp:(.text+0x41f): undefined r eference to `_imp___Z13fnica_dll_amdPdiiS_b' C:\DOCUME~1\Wada\LOCALS~1\Temp\cc6RcquX.o:fecgsep.cpp:(.text+0x718): undefined r eference to `_imp___Z13fnica_dll_amdPdiiS_b' collect2: ld returned 1 exit status ** error 1 ** deleting a.out というエラーが改善できません。どなたかアドバイスをお願いします。

  • c++のビルドエラーについて

    昨日からc++を学習し始めました。 pythonは2年ほどになりますが、c++は初めてだったので、コンパイルでエラーが起こってしまいわからなくなってしまったので質問させていただきました。 hello worldを出力しようと思いやってみたのですが、どこでエラーが起こっているのかがわかりません。 下記が私の書いたソースコードです。 #include <iostream> using namespace std; int main(){ cout << "HelloWorld." << endl; } エラーメッセージ C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `main': C:/Users/ユーザー名/Documents/cpp/hello.cpp:4: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' C:/Users/ユーザー名/Documents/cpp/hello.cpp:4: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `__tcf_0': C:/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::~Init()' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `__static_initialization_and_destruction_0': t::Init()' e to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o:hello.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout' collect2.exe: error: ld returned 1 exit status os:windows11 home 64ビット コンパイラ gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0 エディタ:vscode よろしくお願いいたします。

  • icu ビルドエラー

    いつもお世話になっております。 ICU(International Components for Unicode) http://www-01.ibm.com/software/globalization/icu/index.html を利用しようと、プログラムをビルドしたのですが、 library -lCrun: not found となりビルドできませんでした。 g++ -c -g -MMD -MP -MF build/Debug/GNU-Solaris-x86/main.o.d -o build/Debug/GNU-Solaris-x86/main.o main.cpp mkdir -p dist/Debug/GNU-Solaris-x86 g++ -o dist/Debug/GNU-Solaris-x86/icuapp2 build/Debug/GNU-Solaris-x86/main.o `/usr/bin/icu-config --ldflags` ld: fatal: library -lCrun: not found ld: fatal: file processing errors. No output written to dist/Debug/GNU-Solaris-x86/icuapp2 collect2: ld returned 1 exit status gmake[2]: *** [dist/Debug/GNU-Solaris-x86/icuapp2] エラー 1 gmake[2]: ディレクトリ `/home/a/NetBeansProjects/icuapp2' から出ます gmake[1]: *** [.build-conf] エラー 2 gmake[1]: ディレクトリ `/home/a/NetBeansProjects/icuapp2' から出ます gmake: *** [.build-impl] エラー 2 /usr/lib/libCrun.so.1 というファイルはあるのですが、何か不足があるのでしょうか。 どなたかご教授よろしくお願いいたします。

  • Windowsコモンコントロールのcygwin/gccコンパイルエラー

    以下のサイトのようなWindowsコモンコントロールのプログラムをcygwin/gccコンパイルするとエラーがでます。 (sourceのサイト) http://wisdom.sakura.ne.jp/system/winapi/common/common16.html (ビルドコマンド) gcc -mwindows -mno-cygwin -o main.exe main.cpp (エラー出力) undefined reference to `_ImageList_Destroy@4' undefined reference to `_InitCommonControls@0' undefined reference to `_ImageList_Create@20' undefined reference to `_ImageList_ReplaceIcon@12' undefined reference to `_ImageList_ReplaceIcon@12' collect2: ld returned 1 exit status make: *** [main.exe] Error 1 Windowsコモンコントロールを含んだプログラムをcygwin/gccコンパイルするにはどうすればよいでしょうか? コンパイルは出来ないのでしょうか? よろしくお願いします。

  • C++ リンクについて

    現在LINUX(Vine Linux)でC++の勉強をしています。 やさしいC++という本を読みながら勉強しているのですが、この本でいう「ファイルの分割」という部分でつまっています。 複数のファイルをコンパイルの時にどのようにリンクすればいいのか分かりません。 教本では myfunc.h 関数プロトタイプ宣言 myfunc.cpp 作成した関数の定義 Sample5.cpp main関数の定義(プログラム本体) とあり、それぞれを教本どおりに作成し、 g++ -o Sample5 Sample.cpp でコンパイルしようとすると、 /tmp/ccUgMR4c.o(.text+0x42): In function `main': : undefined reference to `max(int, int)' というエラーが出ます。(maxは作成した関数です。) maxが認識されてないみたいなので、この3つのファイルをつなぎ合わせる操作が必要だと思うのですが、どうすればよいのでしょう? 必要かわかりませんが、gcc -vと入力すると /usr/lib/gcc-lib/i386-vine-linux/3.3.6/specs から spec を読み込み中 コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-vine-linux スレッドモデル: posix gcc バージョン 3.3.6 release (Vine Linux 3.3.6-0vl7) となります。(リンクの方法を調べている時によく出てきていたので記載しました。) 自分なりに様々なサイトを調べたのですが、見つからなかったので質問させていただきます。 本来はもっと理解した上でプログラミングを勉強すべきなのでしょうが、明日までにこの本を読み終えないといけません。 よろしくお願いします。

  • xcodeのビルド時のエラー

    ご覧頂き有難うございます。 現在、opencvを使ってiPhoneアプリの開発を試みているところです。 環境-------- Mac OS 10.6 X Code 3.2 iOS SDK 4.3 open cv 2.2 ------------ http://iphone.moo.jp/app/ このサイトを参考にガウシアンフィルタのプログラムを 組んで実行すると以下のエラーが出ます。 ------------------------------------------------------------------------- Ld build/Debug-iphonesimulator/Test.app/Test normal i386 cd /Users/******/Desktop/Test setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/****/Desktop/Test/build/Debug-iphonesimulator -L/usr/local/lib -L/Users/keisukeyamamoto/Desktop/Test/../OPENCV -F/Users/*****/Desktop/Test/build/Debug-iphonesimulator -filelist /Users/*****/Desktop/Test/build/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/i386/Test.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/*****/Desktop/Test/build/Debug-iphonesimulator/Test.app/Test ld: duplicate symbol _main in /Users/****/Desktop/Test/build/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/i386/fastGaussian.o and /Users/*****/Desktop/Test/build/Test.build/Debug-iphonesimulator/Test.build/Objects-normal/i386/main.o collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1 Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1 ------------------------------------------------------------------------- ググッても中々解決しなかったので質問させていただきました。 何卒宜しくお願い致します。 初心者ですので足りない情報があるかと思いますが、補足が必要な場合は すぐに対応します!

    • 締切済み
    • Mac
  • linuxでリンクを貼るには

    linuxでリンクを貼るには 本に書いてある通りにプログラムをつくったのですが、 うまくコンパイルできません。 本で書いてあるのはwindowsのvisual C++で、 僕の使っている環境はlinuxのg++です。 コンパイルした結果を以下に示します。 -- ファイル名:myfunc.h //declaration of the max function int max(int x, int y); -- ファイル名:myfunc.cpp //a definition of the max function int max(int x, int y) { if(x > y) return x; else return y; } -- ファイル名:sample10.5.cpp #include <iostream> #include "myfunc.h" using namespace std; int main() { int num1, num2, ans; cout << "Please input the 1st integer.\n"; cin >> num1; cout << "Please input the 2nd integer.\n"; cin >> num2; ans = max(num1, num2); cout << "The maximum value is " << ans << '\n'; return 0; } -- bash-2.05b$ g++ myfunc.cpp /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In function `_start': : undefined reference to `main' collect2: ld はステータス 1 で終了しました -- bash-2.05b$ g++ sample10.5.cpp /tmp/ccWJNOkX.o(.text+0x6c): In function `main': : undefined reference to `max(int, int)' collect2: ld はステータス 1 で終了しました

  • Linuxのmake時のエラーについて

    あるプログラムをmakeすると下記のメッセージが出たのですが、どうすれば正常にmakeできますでしょうか?他のPCだとできたようです。 よろしくお願い致します。 g++ -L. -lpthread -lrt -lm -o SchedFifoTest SFthread.o SchedFifoTest.o /usr/bin/ld: SchedFifoTest.o: in function `main': SchedFifoTest.cc:(.text.startup+0x5e): undefined reference to `pthread_setaffinity_np' /usr/bin/ld: SFthread.o: in function `ARCS::SFthread::SFthread(unsigned long, void (*)(void*), void*, int)': SFthread.cc:(.text+0x2e9): undefined reference to `pthread_create' /usr/bin/ld: SFthread.cc:(.text+0x336): undefined reference to `pthread_setaffinity_np' /usr/bin/ld: SFthread.o: in function `ARCS::SFthread::~SFthread()': SFthread.cc:(.text+0x36d): undefined reference to `pthread_cancel' collect2: error: ld returned 1 exit status make: *** [Makefile:51: SchedFifoTest] エラー 1

このQ&Aのポイント
  • 私は高校卒業後18歳から現在65歳まで同じ会社で働いてきましたが、老齢基礎年金の支給額は777,800円です。
  • 満額は780,900円なので、何故私は満額の老齢基礎年金が支給されないのでしょうか?
  • 老齢基礎年金について詳しく知りたい方は、ぜひご覧ください。
回答を見る

専門家に質問してみよう