I am currently using eclipse to try and do some pretty basic C++. When I was trying to configure I noticed G++ was giving me an error. When I troubleshot the problem I found that if I added the namespace std it would compile fine. Why is this?
Code with namespace:
Expand|Select|Wrap|Line Numbers
- #include "TestClass.h"
- using namespace std;
- TestClass::TestClass()
- {
- }
- TestClass::~TestClass()
- {
- }
- int main()
- {
- return 0;
- }
**** Clean-only build of configuration Release for project UseDLL ****
Build complete for project UseDLL
**** Build of configuration Release for project UseDLL ****
make all
Building file: ../src/DllTest.cpp
Invoking: Cygwin C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DllTest.d" -MT"src/DllTest.d" -o"src/DllTest.o" "../src/DllTest.cpp"
Finished building: ../src/DllTest.cpp
Building target: UseDLL.exe
Invoking: Cygwin C++ Linker
g++ -o"UseDLL.exe" ./src/DllTest.o
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
make: *** [UseDLL.exe] Error 1