Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:51:39 +0000



fatal error: defs.cpp: No such file or directory

View Count: 316

[2023-08-19 12:36:18]
User286186 - Posts: 22
Hello, Since I am trying to modularize my code, I want to #include a "defs.cpp" file with some functions in order to use them in my main "modularCode.cpp" ACS.
I compile "defs.cpp" file without any problem.

The problem is triggered when a fatal compilation error arise as I try to compile the main "modularCode.cpp" file that #include "defs.cpp".

modularCode.cpp:3:10: fatal error: defs.cpp: No such file or directory
3 | #include "defs.cpp"
| ^~~~~~~~~~
compilation terminated.

Both files are in the correct folder (ACS_Source) as any other file which is included in my "modularCode.cpp" (for instance, no problem including sierrachart.h or scstructures.h).

Could you please help me ?

Thank you !
[2023-08-19 14:37:04]
User431178 - Posts: 544
Create a header file, defs.h, that has the declarations for the functions in defs.cpp.
Then #include "defs.h" (not #include "defs.cpp").

https://www.learncpp.com/cpp-tutorial/header-files/

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account