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

AI Thread Summary
The discussion revolves around a C++ coding issue related to namespace definition in a FastJet library file. The user encounters a compilation error indicating a missing character at line 37, which defines the beginning of a namespace. There is confusion regarding the terminology used, particularly the difference between running a source file and compiling it into an executable. Participants emphasize the need to compile and link the code before execution. Additionally, there is a request for more context by asking for several lines of code before the error line to better diagnose the issue. The conversation highlights the importance of clear error messages and understanding the compilation process in C++.
malawi_glenn
Science Advisor
Messages
6,735
Reaction score
2,431
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
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!
 
I wrote filename in root, to run the file.

The line 37 is:
#define FASTJET_BEGIN_NAMESPACE namespace fastjet{
 
You can't run C++ source code... you have to compile & link them into an executable, and then run the executable...
 
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.
 
Post at least 5 lines before line 37 too.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Back
Top