2

I recently installed the MiniGW compiler so that I can start learning C++. But when I go to create a new project and have it include main, I get two error messages from the start(after the project has been created) Cannot Find Include File <cstdlib> and Unable to resolve identifier std and when I try and 'Clean and Build' the project, the clean is successful and the build is not. I have done a google search and ran across this post Netbeans 7.2 shows "Unable to resolve identifier" , although build is successful , but I'm not sure my problem is exactly the same since my project won't build (or maybe it is, I don't know), and I'm also not sure I understand the accepted answer. Can this be multiple problems or just one? I want to get this fixed so I can learn!

/* 
 * File:   main.cpp
 * Author: Zf
 *
 * Created on December 16, 2014, 1:50 PM
 */

#include <cstdlib>

using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {

    return 0;
}

Edit: Lines 7 and 8 are where the error messages are.

Community
  • 1
  • 1
LumberSzquatch
  • 1,054
  • 3
  • 23
  • 46

2 Answers2

2

Have you Tool Collection set properly ?

for example <cstdlib> is found in C:\minGW\lib\gcc\mingw32\4.8.1\include\c++

enter image description here

moskito-x
  • 11,832
  • 5
  • 47
  • 60
  • I think that did it, thank you. One more thing though, although the errors went away, I now have a warning on the #include line. It says "There are unresolved includes inside . What does this mean? Did I miss something? Sorry, this is all very new to me, installing ney beans for Java was a lot more simple then this. – LumberSzquatch Dec 17 '14 at 00:13
0
  1. Sounds like you need to tell the compiler where to find cstdlib. See this: How to add a library include path for NetBeans and gcc on Windows?
  2. Cstdlib contains C functions, they are not wrapped in a namespace. Remove the using namespace std; line
Community
  • 1
  • 1
ventsyv
  • 3,316
  • 3
  • 27
  • 49