我有C源代码,我想与Visual Studio 2010一起构建。它引用两个库,我认为我已经正确添加到我的项目中,查看图像。如何用visual C++ express 2010构建C源代码?
据我了解,我应该将源文件重命名为name.c,以便编译为C.当我构建我的解决方案时,我在AssemblyInfo.cpp上得到了一个未定义的命名空间错误。
我该如何解决这些错误?
请注意,我还在程序中获得了.OBJ,.LIB和.MAK文件。当打开.MAK文件我得到以下错误:
编辑:
我recreaated项目为Win32控制台项目。当编译解决方案,我得到了以下错误:
1>------ Build started: Project: SerialCommWin32, Configuration: Debug Win32 ------
1> SerialCommWin32.cpp
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\asynch_1.h(44): error C2143: syntax error : missing ',' before '*'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\asynch_1.h(73): error C2143: syntax error : missing ',' before '*'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(272): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(272): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(272): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(272): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(272): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(447): error C2664: 'wrtst_a1' : cannot convert parameter 4 from 'uint *' to 'int *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(454): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(454): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(454): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(454): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(454): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(464): error C2143: syntax error : missing ';' before '{'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(491): error C2664: 'wrtst_a1' : cannot convert parameter 4 from 'uint *' to 'int *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(498): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(498): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(498): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(498): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(498): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(508): error C2143: syntax error : missing ';' before '{'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(532): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(546): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(585): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(710): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(728): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(746): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(765): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(779): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(779): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(779): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(779): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(779): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(782): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(782): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(782): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(782): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(782): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(946): warning C4309: '=' : truncation of constant value
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1364): error C2664: 'rdst_a1' : cannot convert parameter 3 from 'uchar *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): error C2146: syntax error : missing ')' before identifier 'far'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): error C2065: 'far' : undeclared identifier
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): warning C4197: 'volatile long' : top-level volatile in cast is ignored
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): error C2059: syntax error : ')'
1>c:\users\jgoddijn\documents\development\vanduijnen\serialcommwin32\serialcommwin32\serialcommwin32.cpp(1393): error C2143: syntax error : missing ';' before '{'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
您创建了一个C++/CLI项目。 .NET项目类型。使用适当的项目模板开始。像Win32 +控制台应用程序一样。 –
好,所以我做了,现在看起来好多了,但是我仍然得到了很多语法错误,这让我觉得我仍然需要修复一些设置。看我的编辑。 – jorrebor
没有人可以从错误消息中反向工程代码。但是,包含“远”的代码可以追溯到一个已经过去的时代,那时计算机只能用16个手指计数。避免复制/粘贴您不明白且无法维护的代码。慢一点,花时间学习C编程和winapi。 –