Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: GCC/C Compiler

  1. #11
    Join Date
    Jul 2009
    Location
    Pittsburgh, PA
    Beans
    71
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Post Re: GCC/C Compiler

    Quote Originally Posted by kuruyiva View Post
    How can I include ./ in .bashrc, I mean how does that line look like can you help me ? Thanks
    I've noticed several threads asking the same question, however they all have the same answer...

    There is no way to include ' . ' as a folder along your search path. It is a Unix built-in and the shell script wouldn't know how to handle it. The best I can sugest is that if you have a folder you tend to write all your programs in, add that to your search path.
    --John
    ------------------------------------------------------------------
    <--This is not a valid solution

  2. #12
    Join Date
    Jan 2007
    Location
    Michigan, USA
    Beans
    1,184
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: GCC/C Compiler

    Though you could throw your home directory in there for good measure.

  3. #13
    Join Date
    Jan 2007
    Beans
    Hidden!

    Re: GCC/C Compiler

    Quote Originally Posted by JohnnySage50307 View Post
    I've noticed several threads asking the same question, however they all have the same answer...

    There is no way to include ' . ' as a folder along your search path. It is a Unix built-in and the shell script wouldn't know how to handle it. The best I can sugest is that if you have a folder you tend to write all your programs in, add that to your search path.
    Actually, it is possible to include '.' in your path. Simply add a line like:
    Code:
    PATH=$PATH:.
    to your ~/.profile

    Now, next time you log in, the current directory will be part of your PATH.
    There are various reasons why this is not a very good idea though.

  4. #14
    kjohri is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2008
    Location
    Ghaziabad, India
    Beans
    133

    Re: GCC/C Compiler

    Add the following lines in .bashrc

    PATH=$PATH:.
    export PATH


    Then, you can just give the command,

    a.out

    without the "./"

  5. #15
    Join Date
    Feb 2007
    Location
    Hagerstown MD- USA
    Beans
    11
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: GCC/C Compiler

    I just picked up a book on C++.
    I've successfully installed the build essential.

    No Luck in creating a.out



    Here is the error message list---
    __________________________________________________ _
    :~/Desktop/CPP_Folder$ gcc hello.cpp
    /tmp/cc3PkESq.o: In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
    hello.cpp: (.text+0xe): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
    hello.cpp: (.text+0x59): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >:perator[] (unsigned int) const'
    hello.cpp: (.text+0x97): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >:perator[] (unsigned int) const'
    hello.cpp: (.text+0xdf): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >:perator[] (unsigned int) const'
    /tmp/cc3PkESq.o: In function `main':
    hello.cpp: (.text+0x128): undefined reference to `std::cout'
    hello.cpp: (.text+0x12d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    /tmp/cc3PkESq.o: In function `__static_initialization_and_destruction_0(int, int)':
    hello.cpp: (.text+0x15d): undefined reference to `std::ios_base::Init::Init()'
    /tmp/cc3PkESq.o: In function `__tcf_0':
    hello.cpp: (.text+0x1aa): undefined reference to `std::ios_base::Init::~Init()'
    /tmp/cc3PkESq.o: (.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status
    __________________________________________________ _




    And here is the code---
    __________________________________________________ _
    // My First C++ Program
    #include <iostream>

    int main()
    {
    std::cout << "Welcome to C++!\n";

    return 0; // exit status
    }
    __________________________________________________ _


    any ideas???

  6. #16
    kjohri is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2008
    Location
    Ghaziabad, India
    Beans
    133

    Re: GCC/C Compiler

    Try
    g++ hello.cpp

  7. #17
    Join Date
    Feb 2007
    Location
    Hagerstown MD- USA
    Beans
    11
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: GCC/C Compiler

    Thanks
    Worked perfectly

    Just to insure clarity for anyone who may be following along.

    I had previously tried the compiler name g++ unsuccessfully.

    It is now successful after installing the build-essential package mentioned earlier in this thread.


    Again- a problem solved that had been much more difficult than it was supposed to be. Believe it or not, I'd been banging my head trying to find the right alternate name for the compiler. I just hadn't tried the obvious. If I had paid more attention to the chronology of my attempts, I my not have suffered this ordeal.
    This is a basic error I've I've made before on other topics.


    Thank you Kjohri for saving me much time & aggravation.
    Micronot

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •