C++ now working properly


#1

Hey ppl, got a quick question. Im was writing a code in c++, but encountered a problem (C:\Users\STANIS~1\AppData\Local\Temp\ccnEoouM.o:main.cpp:(.text+0x15): undefined reference to `newClass::newClass()'
collect2.exe: error: ld returned 1 exit status
)

main.cpp

#include iostream>
#include "newClass.h"

using namespace std;

int main()
{
    newClass go;
    return 0;
}

newClass.cpp

#include iostream>
#include "newClass.h"

using namespace std;

newClass::newClass()
{
    cout << "It doesnt work" << endl;
}

myClass.h

#ifndef NEWCLASS_H
#define NEWCLASS_H


class newClass
{
    public:
        newClass();

  
};

#endif // NEWCLASS_H

so why is it working in codeblock but doesnt in atom? there is no spelling mistakes, by somereason it doesnt let me post <> and # signs.
So help…
thanks


#2

Atom doesn’t build or execute code that you’ve written in Atom, see the FAQ:

If your C++ code isn’t working, you should probably take a look at resources for help with C++ such as Stack Overflow.


#3

thanks for ur answer, but gpp-compiler makes it possible to run a few codes. The problem with this code that it doesnt read the myClass.h (header) properly. If in the main.cpp i put #include myClass.cpp> then it runs it perfectly, but once i reference it to the header it doesnt run.
All codes r usually able to run in atom but when it comes to creating different libraries and and files it doesnt


#4

If there’s an issue with a package, you need to bring that up with the package’s maintainers.


#5

As @DamnedScholar said, and the Atom FAQ has information on how to contact the authors of any Atom community package or theme.


#6

It looks like you missed the < in