It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
My Visual Studio 2010 does not allow my file to be compiled when I use the semi-colon characters (";")/ It says there is an error.
But not all of the semi-colons, just one of them.
1>------ Build started: Project: waynekwa, Configuration: Debug Win32 ------
1>Build started 7/11/2012 11:58:46 PM.
1>InitializeBuildStatus:
1> Touching "Debug\waynekwa.unsuccessfulbuild".
1>ClCompile:
1> waynekwa.cpp
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(6): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2059: syntax error : ';'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2143: syntax error : missing ';' before ')'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2143: syntax error : missing ';' before ')'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(12): error C2143: syntax error : missing ';' before '{'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(27): fatal error C1075: end of file found before the left brace '{' at
'c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(3)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The code:
#include<stdio.h>
int main(void) {
int num,x,y=0;
printf("enter range:");
scanf("%i",&num);
for(x=1;x<=;x++) {
if(num%x==0) {
y++;
}
if(y==2) {
printf("it is prime number.\n");
} else {
printf("it is not prime number.\n");
}
return 0;
}
It looks like you forgot a closing bracket for your for loop. You need one between the else of the second if and your return. This is the cause of the second actual error, fatal error C1075: end of file found before the left brace '{'.
Also, for (x = 1; x <= ; x++) is not a valid for loop. The second part x <= ; is missing a value to compare against. For example, x <= 10;. That's where the syntax error error C2059: syntax error : ';' is coming from. The other complaints about semicolons are due to this error.
Edit:
Also, your assignment int num,x,y=0; is difficult to understand. I recommend you clean it up, either by putting on multiple lines or by chain assigning.
Given the information you have given us, you probably need to add or remove one or more ; then add a } somewhere after line 3. But you also may not need to do these things.
The first thing that comes to mind is the line:
for(x=1;x<=;x++) {
you have a x<= just sitting there alone, you have to put a value there.
I'm guessing that you meant:
for(x=1; x<=num; x++) {
But other than that, no other syntax errors are jumping out at me.
Related
In an iOS project in Visual Studio 2015, networked to a Mac, I get this error on build...
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(411,3): error : The given path's format is not supported.
The same solution copied to the Mac builds and runs OK in Visual Studio for Mac preview.
Xamarin.iOS.Common.targets, at line 411 position 3 is this:
<SmartCopy
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
SourceFiles = "#(_BundleResourceWithOutputPath)"
DestinationFiles = "#(_BundleResourceWithOutputPath -> '%(OutputPath)')"
/>
Question: Ids there any way tosee what these tokens resolve to at build-time?
Note: Here is the build output that fails...
. . .
1> Copying file from '/Users/user123483/Library/Caches/Xamarin/mtbs/builds/TrySpeechPlus/d33d40e519762246de1faff7c177fd44/obj/iPhoneSimulator/Debug/optimized/Images/whtball2.PNG' to '/Users/user123483/Library/Caches/Xamarin/mtbs/builds/TrySpeechPlus/d33d40e519762246de1faff7c177fd44/bin/iPhoneSimulator/Debug/TrySpeechPlus.app/Images/whtball2.PNG'
1> SmartCopy: 2017-02-11T10:05:56.0785600-05:00 - Deserializing outputs
1> SmartCopy: 2017-02-11T10:05:56.0805590-05:00 - Creating output items
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(411,3): error : The given path's format is not supported.
1> SmartCopy: 2017-02-11T10:05:56.1110734-05:00 - Finished
1>Done executing task "SmartCopy" -- FAILED.
1>Done building target "_CopyResourcesToBundle" in project "TrySpeechPlus.csproj" -- FAILED.
1>
1>Build FAILED.
Can anyone suggest what the problem might be?
The error is caused by the space in the filename (Program Files (x86)).
A fix is to replace the space with the correct escape string
Replace(" ","%20")
I am porting some C++ code to Android. One of the source files includes a webrtc header file that causes error during compilation. I have reduced the problem to this simple code:
template <class T, int n>
struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>.
static_assert(sizeof(T) == -1, "do not use array with size as type");
};
The error I get is:
[armeabi-v7a] Compile++ thumb: dummyclient <= dummy.cpp
dummy.cpp:7:3: warning: identifier 'static_assert' will become a keyword in C++0x [-Wc++0x-compat]
dummy.cpp:5:8: error: 'DefaultDeleter' is not a template
dummy.cpp:7:17: error: expected identifier before 'sizeof'
dummy.cpp:7:17: error: expected ',' or '...' before 'sizeof'
dummy.cpp:7:70: error: ISO C++ forbids declaration of 'static_assert' with no type [-fpermissive]
The same code compiles fine on Windows and Linux. Is there some compiler settings that are required for Android? Regards.
You need to pass the CPPFLAG -std=c++11.
When installing mapcache in cygwin, make produced:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c: In function ‘mapcache_prefetch_tiles’:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:3: error: unknown type name ‘apr_thread_t’
apr_thread_t **threads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:3: error: unknown type name ‘apr_threadattr_t’
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:83:7: warning: unused variable ‘nthreads’ [-Wunused-variable]
int nthreads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:21: warning: unused variable ‘thread_attrs’ [-Wunused-variable]
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:18: warning: unused variable ‘threads’ [-Wunused-variable]
apr_thread_t **threads;
^
I searched for some hints about this error but didn't find anything. Looking for apr_thread_t and cywgin, I found some pages pointing to an error with apache, but not really sure if apache has something to do here.
Any ideas about this please? what is the mapcache forum? is there any? thanks for any hints on this,
Updating the this answer based on post from the mapserver list by the developer of mapcache:
From http://mail-archives.apache.org/mod_mbox/apr-dev/201209.mbox/%3C4994179EC7ED6843AAB0A30A1639E7F825143612EF#DGEX2V.dg.deltagroup.com%3E it would seem that threads are not supported by Apr on cygwin. Currently mapcache does not support unthreaded environments so there's nothing you can do without hacking the mapcache codebase. I believe the change would not be very extensive as the source WMS fetches only need to be sequentialized instead of parralelized in core.c
I have the following line of code in my program -
typedef GROUP ACE_SOCK_GROUP;
That gives the following warnings and errors -
Warning 181 warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared
Error 182 error C2143: syntax error : missing ';' before 'constant'
Error 183 error C2059: syntax error : 'constant'
The definition of GROUP is given in another file that is included by my program as -
typedef unsigned int GROUP;
What does 'constant' here refer to?
What could be causing the error?
What is the warning indicating
I am using Visual Studio 2008 and found the definition of GROUP using the F12 function
The code is correct.
You're forgetting to include the file where GROUP is defined.
You can try a simple test to confirm this is the issue:
typedef unsigned int GROUP;
typedef GROUP ACE_SOCK_GROUP;
If this compiles, and it will, that means that the previous definition of GROUP is not seen. You need to include the file with the definition before defining ACE_SOCK_GROUP.
I copy
if ((MessageBox::Show(
"Are you sure that you would like to close the form?",
"Form Closing", MessageBoxButtons::YesNo,
MessageBoxIcon::Question) == DialogResult::No))
{
// cancel the closure of the form.
Application::Exit();
}
From msdn. Where I compiling this i have
1>------ Build started: Project: test2, Configuration: Debug Win32 ------
1> test2.cpp
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(103): error C2039: 'No' : is not a member of 'System::Windows::Forms::Form::DialogResult'
1> c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(16) : see declaration of 'System::Windows::Forms::Form::DialogResult'
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(103): error C2065: 'No' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's wrong? How fix this problem?
I’m stumped but the MSDN article for DialogResult mentions in the C++ example that the type name should be prefixed with :: to make it non-nested. Maybe try this:
if (MessageBox::Show(
"Are you sure that you would like to close the form?",
"Form Closing", MessageBoxButtons::YesNo,
MessageBoxIcon::Question) == ::DialogResult::No)
(I also removed the redundant parentheses …)
If it doesn’t help, try specifying the full namespace, i.e. ::System::Windows::Forms::DialogResult::No to see if that at least works.