NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Appears To Be Errors, But Compiles Just Fine

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
urroner



Joined: 03 May 2017
Posts: 1
Location: Kennedy Space Center FL

PostPosted: Wed May 03, 2017 10:37 pm    Post subject: Appears To Be Errors, But Compiles Just Fine Reply with quote

An intern messed up my system tyring to show me something awesome and I've tried fixing everything. Had to reinstall NetBeans 8.0.2 and the compiler. Put them in a directory /sandbox. Now it seems I have errors in my code, but everything compiles correctly and runs just fine.

The person who usually fixes this is gone for a couple of weeks, so it's a great learning opportunity, especially in learning to not trust interns.

class TimeClass
TimeClass.h
Code:

#ifndef TIMECLASS_H
#define   TIMECLASS_H

class TimeClass {
public:
   TimeClass();
   TimeClass(const TimeClass& orig);
   virtual ~TimeClass();
private:

};

#endif   /* TIMECLASS_H */


TimeClass.cpp
Code:


#include <iostream> //"error/warning" reads "Cannot find include file <iostream>"
#include "TimeClass.h"
TimeClass::TimeClass()
{
    // Prints welcome message...
    std::cout << "Welcome ..." << std::endl;
}

TimeClass::TimeClass(const TimeClass& orig) {
}

TimeClass::~TimeClass() { //"error/warning" reads "Unexpected token: TimeClass"
}//"error/warning" reads "Unexpected token: }"


main.cpp
Code:


#include <cstdlib>

using namespace std;

/*
 *
 */

#include "TimeClass.h"
#include <iostream>

int main(int argc, char**argv) {
   
   
TimeClass newObject;
   
    // Prints welcome message...
    std::cout << "Welcome ..." << std::endl;

    // Prints arguments...
    if (argc > 1) {
        std::cout << std::endl << "Arguments:" << std::endl;
        for (int i = 1; i < argc; i++) {
            std::cout << i << ": " << argv[i] << std::endl;
        }
    }
   
    return 0;
}


On a clean build, it puts out:
Code:

"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
gmake[1]: Entering directory `/net/users/lsvedin/NetBeansProjects/TestProject'
rm -f -r build/Debug
rm -f dist/Debug/GNU-Linux-x86/testproject
gmake[1]: Leaving directory `/net/users/lsvedin/NetBeansProjects/TestProject'

CLEAN SUCCESSFUL (total time: 52ms)
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/net/users/lsvedin/NetBeansProjects/TestProject'
"/usr/bin/gmake"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/testproject
gmake[2]: Entering directory `/net/users/lsvedin/NetBeansProjects/TestProject'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/TimeClass.o.d"
gcc    -c -g -MMD -MP -MF "build/Debug/GNU-Linux-x86/TimeClass.o.d" -o build/Debug/GNU-Linux-x86/TimeClass.o TimeClass.cpp
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++ -v   -c -g -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-pc-linux-gnu
Configured with: ./../gcc-6.3.0/configure --prefix=/sandbox/iasupport/gcc-6.3.0
Thread model: posix
gcc version 6.3.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-g' '-MMD' '-MP' '-MF' 'build/Debug/GNU-Linux-x86/main.o.d' '-o' 'build/Debug/GNU-Linux-x86/main.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /sandbox/gcc-6.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/cc1plus -quiet -v -iprefix /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/ -MMD build/Debug/GNU-Linux-x86/main.d -MF build/Debug/GNU-Linux-x86/main.o.d -MP -MQ build/Debug/GNU-Linux-x86/main.o -D_GNU_SOURCE main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase-strip build/Debug/GNU-Linux-x86/main.o -g -version -o /tmp/ccxgUokS.s
GNU C++14 (GCC) version 6.3.0 (x86_64-pc-linux-gnu)
   compiled by GNU C version 6.3.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0"
ignoring duplicate directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0/x86_64-pc-linux-gnu"
ignoring duplicate directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward"
ignoring duplicate directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/include"
ignoring duplicate directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/include-fixed"
ignoring nonexistent directory "/sandbox/gcc-6.3.0/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0
 /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0/x86_64-pc-linux-gnu
 /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
 /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/include
 /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/include-fixed
 /usr/local/include
 /sandbox/gcc-6.3.0/bin/../lib/gcc/../../include
 /usr/include
End of search list.
GNU C++14 (GCC) version 6.3.0 (x86_64-pc-linux-gnu)
   compiled by GNU C version 6.3.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: eac0a0de66b770f4a3341f22661214ec
COLLECT_GCC_OPTIONS='-v' '-c' '-g' '-MMD' '-MP' '-MF' 'build/Debug/GNU-Linux-x86/main.o.d' '-o' 'build/Debug/GNU-Linux-x86/main.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v --64 -o build/Debug/GNU-Linux-x86/main.o /tmp/ccxgUokS.s
GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version version 2.20.51.0.2-5.46.el6 20100205
COMPILER_PATH=/sandbox/gcc-6.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/:/sandbox/gcc-6.3.0/bin/../libexec/gcc/
LIBRARY_PATH=/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/:/sandbox/gcc-6.3.0/bin/../lib/gcc/:/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-c' '-g' '-MMD' '-MP' '-MF' 'build/Debug/GNU-Linux-x86/main.o.d' '-o' 'build/Debug/GNU-Linux-x86/main.o' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
mkdir -p dist/Debug/GNU-Linux-x86
g++ -v    -o dist/Debug/GNU-Linux-x86/testproject build/Debug/GNU-Linux-x86/TimeClass.o build/Debug/GNU-Linux-x86/main.o
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/sandbox/gcc-6.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./../gcc-6.3.0/configure --prefix=/sandbox/iasupport/gcc-6.3.0
Thread model: posix
gcc version 6.3.0 (GCC)
COMPILER_PATH=/sandbox/gcc-6.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/:/sandbox/gcc-6.3.0/bin/../libexec/gcc/
LIBRARY_PATH=/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/:/sandbox/gcc-6.3.0/bin/../lib/gcc/:/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'dist/Debug/GNU-Linux-x86/testproject' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /sandbox/gcc-6.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o dist/Debug/GNU-Linux-x86/testproject /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/crtbegin.o -L/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0 -L/sandbox/gcc-6.3.0/bin/../lib/gcc -L/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../.. build/Debug/GNU-Linux-x86/TimeClass.o build/Debug/GNU-Linux-x86/main.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /sandbox/gcc-6.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.3.0/crtend.o /usr/lib/../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-o' 'dist/Debug/GNU-Linux-x86/testproject' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
gmake[2]: Leaving directory `/net/users/lsvedin/NetBeansProjects/TestProject'
gmake[1]: Leaving directory `/net/users/lsvedin/NetBeansProjects/TestProject'

BUILD SUCCESSFUL (total time: 651ms)


Do I need to give any more info for figuring out this problem?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo