Hi,

I am new to Dev C++ (and C programming iteself!). I was trying to write a project in Dev C++ and I faced two problems. I will really appreciate it if anyone can help:

1- I created a project and added one main file to it. There are some functions that are called in the main file. These functions are defined in other files in the same directory of the main file (I didn't add other files to the project). When I modify the fucntions and I run the project, the result is the same as before! Nothing happens when I change or even delete one of them, and the program is working as if they were unchanged. I am confused with the problem.

2- How can I see the value of the variables that I am using in my program? For example in Matlab I can easily see the variable contents after running my program. But I could't find anywhere in Dev C++ to see the variables and their contents.


Thanks,
Mohammad

IMO you need to stop using Dev-C++ and get Code::Blocks. Code::Blocks is a better IDE, uses newer version of MinGW compiler (g++), and has a better debugger. That will solve your 2nd problem.

As for your first problem, why didn't you add the other *.cpp files to the project?

Sometimes Dev-C++ 'sticks' and fails to save and utilize changes when you edit something. I oftentimes do a 'Clean' from the compile menu which deletes the existing binaries so it forces the IDE to generate new ones.

By all means you should include all the files in your project through the IDE's project functionality. It makes no sense not to do so.

Personally, I don't care for debuggers much. I usually open an output text file/trace file and print my debugging info, i.e., variables to that. In other words,

#include <stdio.h>

int main(void)
{
 FILE* fp=NULL;
 int iNum=5;

 fp=fopen("Output.txt","w");
 if(fp)
 {
    fprintf(fp,"Entering main()\n");
    fprintf(fp,"  iNum=%d\n",iNum);
    fprintf(fp,"Leaving main()\n");
    fclose(fp);
 }
 getchar();

 return 0;
}

//Output
//========================
//Entering main()
//  iNum=5
//Leaving main()

The most absolutely maddening thing about Dev-C++ is the horrible, horrible intrusiveness/buggyness of the d#$^& codetips! Just yesterday I became so exasperated with it I closed a project out and re-set it up with CodeBlocks. Many times the blasted thing is so bad that I have to close out the whole IDE and restart it to get a codetip to close! They even remain on the desktop!

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.