Troubleshooting Error in .cc File: Missing '/' or '\

In summary, the conversation is about a user encountering an error while trying to run a .cc file. The error is related to a missing symbol and the user is unsure how to fix it. They mention that they are using a root program to run the file and that the line 37 in their .hh file is causing the issue. They also ask for clarification on the steps to run C++ source code.
  • #1
malawi_glenn
Science Advisor
Homework Helper
Gold Member
6,735
2,455
I have this in my .cc file:

#ifndef __FASTJET_FASTJET_BASE_HH__
#define __FASTJET_FASTJET_BASE_HH__

// define this for easier readability (and obfuscation?) in
// a range of places
#define FASTJET_BEGIN_NAMESPACE namespace fastjet{
#define FASTJET_END_NAMESPACE}

#endif // __FASTJET_FASTJET_BASE_HH__

When Iam trying to run the file, the prompt says:

Error: Missing one of '
\/' expected at or after line 37.

And I have NO idea what Iam suppose to fix =/
 
Technology news on Phys.org
  • #2
Did you mean in your *.hh file? And what do you mean by "run the file"?

It's kind of hard to guess what the problem is when you don't even quote line 37; a few lines before that might even be necessary!
 
  • #3
I wrote filename in root, to run the file.

The line 37 is:
#define FASTJET_BEGIN_NAMESPACE namespace fastjet{
 
  • #4
You can't run C++ source code... you have to compile & link them into an executable, and then run the executable...
 
  • #5
Hurkyl said:
You can't run C++ source code... you have to compile & link them into an executable, and then run the executable...


Iknow, I just wanted to ask what error I have made in the code.
 
  • #6
Post at least 5 lines before line 37 too.
 

Related to Troubleshooting Error in .cc File: Missing '/' or '\

1. How do I know if my .cc file is missing a '/' or '\'?

If you are receiving an error message about a missing '/' or '\', it is likely that your .cc file is indeed missing one of these symbols. You can check by opening the file in a text editor and searching for these symbols. They are commonly used to indicate file paths or to separate directories in a file path.

2. What causes a missing '/' or '\' error in a .cc file?

This error usually occurs when the file path in your code is not properly formatted. If you are manually typing the file path, it is easy to accidentally leave out a '/' or '\' symbol. It can also happen if you copy and paste code from another source and the file paths are not adjusted correctly.

3. How can I fix a missing '/' or '\' error in my .cc file?

To fix this error, you will need to carefully check the file path in your code and make sure it is correctly formatted with the necessary '/' or '\' symbols. If you are unsure, you can refer to the file path of other working code in your project for reference. Once the file paths are correct, the error should be resolved.

4. Can a missing '/' or '\' cause other errors in my .cc file?

Yes, a missing '/' or '\' can cause other errors in your .cc file. Since these symbols are used to indicate file paths, if they are missing, the compiler will not be able to locate the necessary files or directories. This can result in additional errors such as "file not found" or "directory not found" errors.

5. Is there a way to prevent missing '/' or '\' errors in my .cc file?

One way to prevent these errors is to double check your file paths before running your code. It may also be helpful to use a code editor with syntax highlighting to easily spot any missing symbols. Additionally, using relative file paths instead of absolute file paths can help minimize the risk of missing '/' or '\' errors.

Similar threads

  • Programming and Computer Science
3
Replies
75
Views
4K
  • Programming and Computer Science
Replies
5
Views
829
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
3
Replies
89
Views
4K
  • Programming and Computer Science
Replies
4
Views
8K
  • Programming and Computer Science
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Programming and Computer Science
Replies
5
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top