When I build and link: g++ -o des des.o -L. -lcryptopp error messages:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status On 2月20日, 下午5時31分, lcli <[email protected]> wrote: > Sorry for the confusion. > Actually, I like to generate executable files from .cpp in crypto. > I run "make -f gnumakefile" and it produces .o files with no errors. > What should I do if I want to generate executable files such as > des,rc6,...? > > On 2月20日, 上午12時38分, Eugene Zolenko <[email protected]> wrote: > > > > > Wait, is that all of your build? O_O > > > Just > > g++ -o des des.o libcryptopp.a > > ? > > > Read on compiler cmd line if you want to manually build stuff. (Or > > build something with make and look at what exactly it runs, which > > order and why) > > > In this case, assuming des.o was created by compiling des.cpp, that > > contains your full program and that has > > int main(int, char**); > > defined and implemented, the way you would build it and link it to a > > pre-built cryptopp library (found in one of standard library paths) > > would be this: > > > g++ -o des des.o -lcryptopp > > > That will produce "des" binary that will be an executable linked to > > cryptopp library... (assuming neither you app nor cryptopp need any > > other libraries). > > > But the fact that there is a file called "des.cpp" in crypto, makes me > > suspect you are trying to link _that_ to libcryptopp.a. That doesn't > > make any sense :). > > > So, what exactly are you trying to do here? :) > > > On Feb 19, 5:03 am, lcli <[email protected]> wrote: > > > > Thanks,but how to create executable file des > > > > On 2月19日, 上午12時36分, Eugene Zolenko <[email protected]> wrote: > > > > > For whatever reason it tries to link an executable, not a library. To > > > > link a library you should use ar, not g++. > > > > > ar libcryptopp.a des.o bla1.o bla2.o etc.o > > > > > > My platform is Linux fedora 9 > > > > > > On 2月18日, 下午2時08分, lcli <[email protected]> wrote: > > > > > > > Hi, > > > > > > > I got the following error messages when I tried to link cryptopp552 > > > > > > using gcc version 4.3.0. > > > > > > There is no problem when I make gnumakefile. > > > > > > > ex. g++ -o des des.o libcryptopp.a > > > > > > > /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o: In function > > > > > > `_start': > > > > > > (.text+0x18): undefined reference to `main' > > > > > > collect2: ld returned 1 exit status > > > > > > > Kind regards, > > > > > > > Robert- 隱藏被引用文字 - > > > > > - 顯示被引用文字 -- 隱藏被引用文字 - > > > - 顯示被引用文字 -- 隱藏被引用文字 - > > - 顯示被引用文字 - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
