问题描述
我试图集成两个项目,为此,包括头文件从一个到另一个。我使用visual studio 2008 express。
int E4407B_PPM(int&);
在新项目中引发错误,但原始项目编译正常。
我得到的错误:
错误C2143:语法错误:missing') 'before'&'
有任何想法吗?
编辑:我最后删除参数引用的行,并保证所有的功能在实际源文件中使用之前声明。我想这是一个C ++ / C的东西。
你可能正在构建第二个项目as straight C.确保文件有一个.cpp扩展名或者你正在强制一个C ++编译(你可以使用 / TP
编译选项来实现)。
编辑您可以为单个文件指定它:右键单击解决方案资源管理器中的文件,然后选择属性。单击 C / C ++
下的高级选项。选择编译为C ++代码(/ TP)(我的Visual Studio版本的第二个选项)。
I'm trying to integrate two projects, and to that end am including header files from one into the other. I'm using visual studio 2008 express.
The line
int E4407B_PPM(int &);
is throwing errors in the new project, but the original project compiles just fine.
The error I'm getting:
error C2143: syntax error : missing ')' before '&'
Any ideas?
Edit: I ended up removing the lines that took parameters in by reference, and just insured that all functions were declared before they were used in the actual source file. I guess it was a C++/C thing.
You are probably building the second project (or at least the source file) as straight C. Make sure the file has a .cpp extension or that you are forcing a C++ compile (you can use the /TP
compile option to do that).
Edit You can specify it for a single file: Right click on the file in the solution explorer and select Properties. Click on the Advanced option under C/C++
. Choose "Compile as C++ Code (/TP)" (second option in the page in my version of Visual Studio).
这篇关于头文件在一个项目中抛出错误,但在另一个项目中抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!