Hello everyone, I am VERY new to programming. I have downloaded and installed the Dev-C++ compiler and I am using it with the C++ for dummies book and when I try to compile my simple "This is my computer talking" program, I come up with 70 library based errors.

Is there a place I can go to get files for my library? A CD came with the For dummies book, but files are mislabeled in there and no matter what I install, I get the same errors. This is really frustrating me and I have no idea how to fix it or where to go. Any help would be greatly appreciated.

-Zanziff

Depending on the libraries, Dev C++ comes with most of the libraries already. They are installed in the correct place when Dev C++ installs. try this:

// HelloWorld.cpp
#include <iostream>
using namespace std;
int main ()
{
     cout << "Hello World!" << endl;
     getchar (); // pause
     return 0;
}

You should get no errors when you compile and run this. It should display "Hello World!" to the console. Press the Enter key to end the program. if it doesn't do that, uninstall and resinstall Dev C++ and try again, or in some other way try to fix Dev C++. If it does work, we'll need more information on the errors and the code and which libraries you are using.

Thank you very much. I'll plug it in and see what happens right away! :)

Well that seemed to help out a lot. My errors went from 70 down to one. This is what it was:

[Linker error] undefined reference to `WinMain@16'
 C:\Dev-Cpp\Makefile.win
[Build Error]  [Project1.exe] Error 1

Ill pop this one is as well just in case it helps

g++.exe main.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib"  -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/c++"  -I"C:/Dev-Cpp/include"  

C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

make.exe: *** [Project1.exe] Error 1

Execution terminated

The program I posted is a console application. If you created a project in Dev C++ with the above program and chose "Windows Application", I imagine it would give you an error like that since I think (not positive) that Windows Applications wants "main" to be called "WinMain". Try the program I posted as a console application. I'm not too familiar with non-console applications in Windows. Also, I see the words "main.c" in your post. There is an option of C versus C++ when you are creating projects/files in Dev C++. Make sure you check C++ for the program I posted.

I did have it as a console application. The book I'm trying to learn from advises to use that one and I made sure the C++ button was selected when starting my new project, but now I am being hit with 70 errors again.

I think I am just going to give up for tonight and try to tackle it again tomorrow. I'm too confused.

Thank you for the help though, I will subscribe to this so I can come back to it tomorrow

You actually don't even need to do it as a project. Just do this:

File->New->Source File (as opposed to "Project")

Name your file "HelloWorld.cpp", copy and paste my code into it, save it, then from the "Execute" pull-down menu, choose the "Compile & Run" option.

See if that works.

Regarding the 70 errors, it's possible that you created the new program/file, but didn't add that file to the project, and didn't remove the old files from the project. You can create a new project and only add that one file and see what happens. Dev C++ doesn't automatically add new files that you create to the project or remove the old ones. You have to do that yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.