Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to debug multiple files with onlinegdb?

+3 votes
asked Feb 22 by KavyaKinjalk (160 points)
I have a driver file, or a main file not sure what it's called in c. it includes another file called document.c which has the code I need to debug. I also have a header file document.h which I am trying to import from the source file but it says no does not exist. Is it possible to debug in onlinegdb or not? you can only debug single files?

1 Answer

+1 vote
answered Mar 7 by Peter Minarik (89,130 points)

Debugging works for the whole project.

Can you perhaps share your project so we can look at what's happening there?

For starters, you shouldn't really include any source file (.c), only header files (.h).

If the compiler says the file does not exist, then the file does not exist. Maybe there's a typo in the file name. File names are also case-sensitive so if your file is called Manager.h and you try to #include "manager.h", then the compiler will not find the file.

commented Mar 7 by KavyaKinjalk (160 points)
Thank you for your response. This is the project: https://onlinegdb.com/-alSj4_lK. Here, I am trying to run public1.c, which is the driver file. All the important code exists in document.c. Is there any way to run this program? it does work locally, and the program does run. I came here to try and debug some issues that I was facing. I think that the folder structure is perhaps different here.. which is why it is unable to find the header file.
commented Mar 8 by Peter Minarik (89,130 points)
Your shared project looks unusual.

Did you get the share link with the orange SHARE button 3 to the right from the RUN button?

A shared project should look like this one: https://onlinegdb.com/A_q5zUcOK

You shared files, not the project, I'd need to copy them one by one. Also, there's no public1.c file.

Without seeing what's going on I'd suggest checking how many main() functions you have. You should only have one, otherwise the compiler wouldn't know which one to use.

I'd just comment out the rest.
commented Mar 10 by KavyaKinjalk (160 points)
Hello, thank you very much for your response. By looking at your project I was able to figure out how to make a multi file project properly. Thank you very much for your help and kindness.
commented Mar 10 by Peter Minarik (89,130 points)
No problem. I'm glad you're sorted! :)

Keep on coding!
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.