Thread: compiling C++ with NetBeans

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    66

    compiling C++ with NetBeans

    Hi, I'm having problems setting up a working C++ using NetBeans. But some things aren't working, as if it doesn't have the needed libraries.I tried following this guide, but it didn't sort it out:
    c/c++ compiler for NetBeans 6.5 (under Windows)

    Here's screenshots of my PATH settings:
    ImageShack Album - 3 images

    I need to get this working rather quickly and non of my tinkering has solved the issues I have.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Do you really want to use Cygwin? I once configured Netbeans to use the MinGW port of g++ by following the "Installing MinGW" instructions given here: Introducing Netbeans C/C++ Pack.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    66
    Okay, I followed the steps in that link under the "Installing MinGW". However, I still get errors on statements such as "cout" and "endl". C stuff seems fine, such as "printf".

    I did not understand what it meant when the guide said "You will still have to add the MSys programs folder to the system PATH (in my case, E:\MSys\1.0\bin), as you did for the MinGW base distribution. "

    I only restored default in NetBeans so that it found all the paths itself, but I have a feeling this text might be talking about something I need to do through cmd? (I'm using Windows 7).

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Do you need to use NetBeans specifically? If not and you need to get things working quickly, I can also suggest Code::Blocks with mingw. It isn't big, and should work right out of the box.
    Alternatively there's Visual Studio, but it's rather large.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Furious5k
    However, I still get errors on statements such as "cout" and "endl". C stuff seems fine, such as "printf".
    I have no idea what is the level of your C++ knowledge, but just to be sure that you are trying to compile something that is supposed to compile, try compiling:
    Code:
    #include<iostream>
    #include<string>
    
    using namespace std;
    
    int main()
    {
        string s;
        cout << "Please enter your first name followed by a newline\n";
        cin >> s;
        cout << "Hello, " << s << '\n';
        return 0; // this return statement isn't necessary
    }
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Dec 2008
    Posts
    66
    *facepalm*

    I was doing C last semester and I've been trying to use #include <stdio.h>, which is of course why printf works and cout doesn't.

    Thanks for sorting me out.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Heh. Well, there we go.
    I didn't consider you were writing invalid C++ code.
    Well, good it worked out for you. Now, good luck.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling errors and using Cmake Set Policy
    By eligor in forum Linux Programming
    Replies: 2
    Last Post: 01-25-2010, 01:43 PM
  2. Compiling C++ with Netbeans for Windows
    By Noise in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2009, 01:39 AM
  3. from dev-c++ mingw to netbeans cygwin
    By yahn in forum C++ Programming
    Replies: 10
    Last Post: 01-14-2009, 08:18 AM
  4. NetBeans + Cygwin driving me insane
    By Del75 in forum C++ Programming
    Replies: 4
    Last Post: 08-17-2008, 05:03 AM
  5. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM