安装ns2时如何在makefile中设置gcc编译器版本?

时间:2022-06-01 14:02:33

while installing ns2 according to the steps mentioned here: http://stanjuly.wordpress.com/2011/12/22/install-ns2-ns-allinone-2-35-on-ubuntu-11-04-for-beginners/

按照此处提到的步骤安装ns2:http://stanjuly.wordpress.com/2011/12/22/install-ns2-ns-allinone-2-35-on-ubuntu-11-04-for-beginners/

In Step 4, when i opened my make file, my make file looks like this:

在第4步中,当我打开make文件时,我的make文件如下所示:

    CC=     @CC@ 
    CFLAGS=     @CFLAGS@
    RANLIB=     @RANLIB@
    INSTALL=    @INSTALL@

    #
    # how to compile, link, and name shared libraries
    #

    SHLIB_LD=   @SHLIB_LD@
    SHLIB_CFLAGS=   @SHLIB_CFLAGS@
    SHLIB_SUFFIX=   @SHLIB_SUFFIX@
    SHLD_FLAGS= @DL_LD_FLAGS@
    DL_LIBS=    @DL_LIBS@

    SHLIB_LD_LIBS  = @SHLIB_LD_LIBS@

    #
    # where to install shells, libraries, and includes
    #

    INST_OTCLSH=    @prefix@/bin
    INST_OWISH= @prefix@/bin
    INST_OLIB=  @prefix@/lib
    INST_OLIBSH=    @INST_OLIBSH@
    INST_OINC=  @prefix@/include


    #
    # ------------ you shouldn't need to configure below here -----------------
    #

the instructions say that i am supposed to change CC = @CC@ to CC = @CC@ -V 4.7.0 (4.7.0 because when i type gcc --version on my terminal it says):

说明说我应该将CC = @ CC @改为CC = @ CC @ -V 4.7.0(4.7.0,因为当我在我的终端上输入gcc --version时它说:)

    gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3  

But when instlaiing ns2 (step5): sudo ./install i get the following error:

但是在实现ns2(步骤5)时:sudo ./install我收到以下错误:

        config.status: creating Makefile
        rm -f libotcl.a otcl.o
        gcc -V 4.7 -c -g -O2 -DNDEBUG -DUSE_SHM -DHAVE_UNISTD_H=1 -I. -I/home/me/ns-

        allinone-2.35/include -I/home/me/ns-allinone-2.35/include -I/home/me/ns-

        allinone-2.35/include -I/include  otcl.c
        gcc: error: unrecognized command line option ‘-V’
        gcc: error: 4.7: No such file or directory
        make: *** [libotcl.a] Error 1
        otcl-1.14 make failed! Exiting ...

How am i supposed to modify makefile that i dont get this error? Do i have the gcc compiler installed? I dont understand. I dont know how to check if it is installed.

我该如何修改makefile,我不会收到此错误?我是否安装了gcc编译器?我不明白我不知道如何检查它是否已安装。

2 个解决方案

#1


1  

This means your compiler is not compatible and if you don't want to install gcc 4.4 than change

这意味着您的编译器不兼容,如果您不想安装gcc 4.4而不是更改

CC = gcc-4.4

to

CC = @CC@

in makefile and makefile.in present in otcl folder and also change

在makefile和makefile.in中存在于otcl文件夹中并且也会更改

SHLIB_LD="ld -shared"

to

SHLIB_LD="gcc -shared"

in configure file

在配置文件中

#2


0  

You need to install an old version of gcc: (Newer versions dosent work)

您需要安装旧版本的gcc :(较新版本的剂量工作)

apt-get install gcc-4.4 (4.4 is the older version that I found on my repository)

apt-get install gcc-4.4(4.4是我在我的存储库中找到的旧版本)

And change

CC= @CC@

for:

CC=gcc-4.4

#1


1  

This means your compiler is not compatible and if you don't want to install gcc 4.4 than change

这意味着您的编译器不兼容,如果您不想安装gcc 4.4而不是更改

CC = gcc-4.4

to

CC = @CC@

in makefile and makefile.in present in otcl folder and also change

在makefile和makefile.in中存在于otcl文件夹中并且也会更改

SHLIB_LD="ld -shared"

to

SHLIB_LD="gcc -shared"

in configure file

在配置文件中

#2


0  

You need to install an old version of gcc: (Newer versions dosent work)

您需要安装旧版本的gcc :(较新版本的剂量工作)

apt-get install gcc-4.4 (4.4 is the older version that I found on my repository)

apt-get install gcc-4.4(4.4是我在我的存储库中找到的旧版本)

And change

CC= @CC@

for:

CC=gcc-4.4