Finding the default project settings file - visual-studio-2012

I'm trying to write a plugin for 3ds max, I went through the entire sdk installation process to the letter as described in the help files.
The problem I'm facing though is intellisence complaining about an invalid macro definition
"IntelliSense: command-line error: invalid macro definition:_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT =1"
I found the definition in project settigs -> c/c++ -> preprocessor definitions as inherited from parent or project default.
I tried disabling the inherited definitions and re-entered them, this time without the space between the name and the = and all works fine so I'm guessing its a typo on their part?
Anyway, I want to change the default project or whatever to not repeat it every time i start a new project. The project is created with a wizard which required me to copy over some files to appear and after which I had to enter the sdk path.
The files I copied are plain text with some fancy extensions and not much in them so I'm guessing the defaults are described in the sdk directory.. somewhere. Does anybody know what kind of a file I'm looking for?
EDIT: I found a file called root.vcxproj_template and it has a section for preprocessor definitions but all it contains is
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
and no mention of the broken one
EDIT2: in another part of the file there was a path to a property sheet (maxsdk\ProjectSettings\propertySheets\3dsmax.common.tools.settings) which included the faulty definition. I fixed it an no more complaints from VS.

_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 1 means that compiler should replace all old C run-time routines such as sprintf, strcpy, strtok with new versions such as strprintf_s, strcpy_s, strtok_s and similar. It goes in pair with following definition _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 1.
More you can find here: (MSDN) https://msdn.microsoft.com/en-us/library/ms175759.aspx. However I tried to use this but without success. It says that you can use this only for statically allocated buffers like char buffer[32], but compilers was still complaining bout unsecure strcpy.

Related

Why Is Doppl Trying To Pull in ReactiveStreams?

I am attempting to convert parts of an Android app to iOS using Doppl, and I am getting a strange result: Doppl keeps trying to pull in android.arch.lifecycle:reactivestreams, even though I don't want it to.
Specifically, in app/build/j2objcSrcGenMain/android/arch/lifecycle/, there is a reactivestrams/ subdirectory with R.h and R.m files in it. This seems to make Xcode cranky and may explain why I had some oddities with pod install.
My app/build.gradle has compile "android.arch.lifecycle:reactivestreams:$archVer", because my activity is using LiveDataReactiveStreams.fromPublisher(). However:
The activity is not in the translatePattern (and since its code is not showing up in app/build/j2objcSrcGenMain/, I have to assume that the translatePattern is fine)
I do not have a doppl statement related to reactivestreams, because there does not appear to be a Doppl conversion of this library (nor should it be needed here)
AFAIK, nowhere else in this app am I referring to LiveDataReactiveStreams, which AFAIK is the one-and-only public class from the reactivestreams library
So, the questions:
What determines whether Doppl creates R.h and R.m files for some dependency? It's not the existence of a doppl statement, as I have doppl statements for a lot of other dependencies (RxJava, RxAndroid, Retrofit) and those do not get R.h and R.m files. It's not whether the dependency is referenced from generated code, as my repository definitely uses RxJava and Retrofit, yet there are no R files for those.
How can I figure out why Doppl generates R.h and R.m for reactivestreams?
Once I get this cleared up... do I re-run pod install, or is there some other pod command to refresh an existing pod with a new implementation?
Look into 'app/build/generated/source/r/debug' and confirm there's an R.java being created for the architecture component. It'll be under 'android/arch/lifecycle/reactivestrams'.
I think there are 2 problems here.
Problem 1
Somehow Doppl/J2objc is of the opinion that this file should be transpiled. It could be either that 'translatePattern' matches with it, or that something in the shared code is referencing it. If you can't figure out which, please post a comment and I'll try to help (or post in slack group).
Problem 2
Regardless of why that 'R.java' is being sucked into the translate step, because of how stock J2objc is configured, the code is being generated with package folders instead of creating One Big Name. That generated file should be called 'AndroidArchLifecycleReactivestramsR.h' (and AndroidArchLifecycleReactivestramsR.m). Xcode really doesn't like package folders. That's why there's a slightly custom J2ojbc being used with Doppl, so we can have files with big names instead of folders.
In cases where you intentionally use package names that match with what J2objc considers to be "system" classes, you need to provide a header mapping file to force long names. The 'androidbase' doppl library needs to add a lot of files that are in the 'android' package, which J2objc considers "system". We override those names in the mapping file.
build.gradle
https://github.com/doppllib/core-doppl/blob/master/androidbase/build.gradle#L19
mapping file
https://github.com/doppllib/core-doppl/blob/master/androidbase/src/main/java/androidbase.mappings
I screwed up.
In my dopplConfig, I have:
translatePattern {
include '**/api/**'
include '**/arch/**'
include '**/RepositoryTest.java'
}
In this case, **/arch/** not only matches my arch package, but also the arch package from the Architecture Components.
Ordinarily, this would not matter, because the Architecture Components source code is not in my project. But, R.java gets generated, due to resources, and the translatePattern includes generated source code in addition to lovingly hand-crafted source code. So, that's where my extraneous Objective-C was coming from.
Many thanks to Kevin Galligan for his assistance with this, out on the #newbiehelp Doppl Slack channel!

How to modify modelica library examples

I am trying to run the PumpingSystem Example in the openmodelica Fluid library using the nightly build 1.9.1+dev (r21018). Unfortunately the simulation crashes saying it failed to solve NLS at initialization.
I tried to modify the model either by creating a new one extending it (which only permits the modification of the parameters but not the structure, I understand that this is probably what extension means) or by copying the text view of the model to a new file, but then OMEdit crashes.
Will you please advise how I can create a copy that I can modify?
Thank you.
PS: I am running this on Linux, the Windows version seems to translate all libraries,creates an infinite amount of translation errors "expected package to have within ; but got ..." and then terminates with a translation error "C:/OpenModelica1.9.1Nightly/lib/omlibrary/Modelica 3.2.1/Blocks/Continuous/Internal/Filter/Utilities/normalizationFactor.mo:14:3-42:27] Error: An element with name normalizationResidue is already declared in this scope."
You can not modify the system libraries. You can only extend them.
Creating a copy of the model is currently not supported. You can follow this ticket https://trac.openmodelica.org/OpenModelica/ticket/2190
If you just copy paste the text, as you already did, you need to manually update the relative paths used in the model.

fatal error LNK1106: invalid file or disk full: cannot seek to 0x5A57BEBC

I got this error using Visual Studio 2008 and I found a solution on the web here and here. But I can't find out how to configure link.exe.
How can I set the /expectedoutputsize:600000000 option for linker.exe in VS2008? I searched in the project properties in the Linker section, but I can't find the place...I searched in the solution and in Visual Studio options. I found the linker.exe.config but I don't know the schema.
My problem is not the disk space, I have plenty of disk space. Any help?
The option must be added in the Project Settings->Librarian->Command Line->Additional options: text box.
Sorry to resurrect this old thread, but I had a similar problem yesterday, and my solution had nothing to do with anything I found online. This is the first SO post that comes up, so I figured I would contribute in case anyone as the same problem.
Here is how I ran into the problem:
I originally had a project that created an exe:
MyProject.vcxproj -> MyProject.exe
I then turned the original project in to a .lib project by splitting main.cpp out to a separate .exe project. I set the target name for the exe project to be the same as the lib, so that we wouldn't change our executable name. I also added a different .exe project that uses the library but has a slightly different main.cpp
MyProject.vcxproj -> MyProject.lib
MyProjectVariant1.vcxproj -> MyProject.exe
MyProjectVariant2.vcxproj -> MyProjectVariant2.exe
The way our solution is currently laid out, all of the projects dump their targets into the same output directory.
The problem was that both the .lib and first .exe share the same target name, so any secondary files (pdb files, iobj, ipdb, etc.) would get overwritten. MyProject.exe would literally overwrite these ancillary files before it could link in the MyProject.lib.
Conclusion:
I "fixed" the problem by using a unique target name for the first variant. We will also review our build strategy to see if we should be using different output directories for each project instead of slamming them all together in the same location. Seems more logical to give them different target directories.

Strange link error - LNK1224: Invalid Image Base

I'm having some real difficulties porting a really old Visual Studio 97 C++ project to Visual Studio 2010. Let me begin by first giving a little background on the errors I was getting immediately prior to this new LNK1224 error because they may be related, but I'm not sure.
Prior to my new error I was receiving this error:
error LNK2005: "void __cdecl operator delete(void *)" (??3#YAXPAX#Z) already defined in LIBCMT.lib(delete.obj) nafxcw.lib(afxmem.obj)
Through some digging I found that the reason for this error was because both the MFC and CRT libraries contain definitions for "new" and "delete" so they were colliding. Microsoft provides 2 solutions for this detailed in http://support.microsoft.com/kb/q148652/ . One of them was to make sure that in all your files you always include the MFC headers (afx stuff) first. Well there are about 100 files in this project and I just got tired of trying to find the files that were including resources in the wrong order. So I went with the other solution which is basically forcing libraries to load in a particular order. Basically you have to tell the compiler to ignore a particular library so that you can load it explicitly your self in the order that you choose. In my case, it was nafxcw.lib.
So under Project Properties --> Linker --> Input, I explicitly ignored nafxcw.lib and then explicitly included it at the front of the list.
So after doing this, my LNK2005 errors went away. But they were replaced with one single link error.
error LNK1224: invalid image base 0x287600000
I don't know if I fixed my previous link errors correctly and this new link error is in fact the next thing I have to deal with, or I simply created a more critical link error that is basically stopping the linking process before it gets to my original LNK2005 errors. In either case, there isn't much information I could find on this error. Microsoft doesn't say much in this link about it http://msdn.microsoft.com/en-us/library/3ya3f8wz%28v=vs.80%29.aspx
You specified an invalid base address for the image. Base addresses must be 64KB aligned (the last four hex digits must be zero) and image base must fit within a 32-bit signed or unsigned value.
This isn't all that helpful to me and there seems to be no other clues as to where this problem is coming from. I don't know what the next step is.
OK, so it looks like I have solved my own problem. Here is what I did. I needed to know where the heck this number was coming from so I simply used Notepad++ to do a word search through all the project files looking for "2876" which I got from the error message "LINK : fatal error LNK1224: invalid image base 0x287600000". I found that in the project file (.vcxproj) had the following entry in it:
<BaseAddress>0x287600000</BaseAddress>
So I opened it up and sat there wondering how this number was wrong. I mean I don't even know what this field is for. I didn't even generate this file, M$ made it. Why would the IDE create it's own input file incorrectly? Anyways, as I was trying to google this "BaseAddress" item to figure out what it was, it dawned on me that it looked like there were too many zero's. So I went back and counted and sure enough, this wasn't a 32-bit number, it was a 36-bit number. Deleted one of the zero's, recompiled, and boom it worked. Low and behold, that's kind of what the defintion I looked up, mentioned in the problem statement, hinted at looked up earlier on MSDN but it didn't click.
I don't make a habit to rummage through auto generated files very often so I never questioned that this may be the problem.

Link libraries with dependencies in Visual C++ without getting LNK4006

I have a set of statically-compiled libraries, with fairly deep-running dependencies between the libraries. For example, the executable X uses libraries A and B, A uses library C, and B uses libraries C and D:
X -> A
A -> C
X -> B
B -> C
B -> D
When I link X with A and B, I don't want to get errors if C and D were not also added to the list of libraries—the fact that A and B use these libraries internally is an implementation detail that X should not need to know about. Also, when new dependencies are added anywhere in the dependency tree, the project file of any program that uses A or B would have to be reconfigured. For a deep dependency tree, the list of required libraries can become really long and hard to maintain.
So, I am using the "Additional Dependencies" setting of the Librarian section in the A project, adding C.lib. And in the same section of B's project, I add C.lib and D.lib. The effect of this is that the librarian bundles C.lib into A.lib, and C.lib and D.lib into B.lib.
When I link X, however, both A.lib and B.lib contain their own copy of C.lib. This leads to tons of warnings along the lines of
A.lib(c.obj) : warning LNK4006 "symbol" (_symbol) already defined in B.lib(c.obj); second definition ignored.
How can I accomplish this without getting warnings? Is there a way to simply disable the warning, or is there a better way?
EDIT: I have seen more than one answer suggesting that, for the lack of a better alternative, I simply disable the warning. Well, this is part of the problem: I don't even know how to disable it!
As far as I know you can't disable linker warnings.
However, you can ignore some of them, using command line parameter of linker eg. /ignore:4006
Put it in your project properties under linker->command line setting (don't remember exact location).
Also read this:
Link /ignore
MSDN Forum - hiding LNK warnings
Wacek
Update If you can build all involved project in single solution, try this:
Put all project in one sln.
Remove all references to static libraries from projects' linker or librarian properties.
There is "Project Dependencies..." option in context menu for each project in Solution Explorer. Use it to define dependencies between project.
It should work. It doesn't invalidate anything I said before, the basic model of building C/C++ programs stays the same. VS (at least 2005 and newer) is simply smart enough to add all needed static libraries to linker command line. You can see it in project properties.
Of course this method won't help if you need to use already compiled static libraries. Then you need to add them all to exe or dll project that directly or indirectly uses them.
I don't think you can do anything about that. You should remove references to other static libs from static libs projects and add all needed static libs projects as dependences of exe or dll projects. You will just have to live with fact that any project that includes A.lib or B.lib also needs to include C.lib.
As an alternative you can turn your libraries into dlls which provide a richer model.
Statically compiled libraries simply aren't real libraries with dependency information, etc, like dlls. See how, when you build them, you don't really need to provide libraries they depend on? Headers are all that's needed. See? You can't even really say static libraries depend on something.
Static library is just an archive of compiled and not yet linked object code. It's not consistent whole. Each object file is compiled separately and remains separate entity inside the library. Linking happens when you build exe or dll. That's when you need to provide all object code. That's when all the symbol and dependency resolving happens.
If you add other static libraries to static library dependencies, librarian will simply copy all code together. Then, when building exe, linker will give you lots of warnings about duplicate symbols. You might be able to block those warnings (I don't know how) but be careful. It may conceal real problems like real duplicate symbols with differing definitions. And if you have static data defined in libraries, it probably won't work anyway.
Microsoft (R) Incremental Linker Version 9.00.x (link.exe) knows argument /ignore:4006
You could create one library which contains A, B, C & D and then link X against that.
Since it's a library, only object modules which are actually referenced will get linked into the final executable.
Note that one way of getting this warning is to define a member function in a header without the inline statement:
// Foo.h
class Foo
{
void someFunction();
};
void Foo:someFunction() // Warning! - should be "inline void Foo::someFunction()"
{
// do stuff
}
The problem is you are not localizing library C's symbols. So you have a ODR violation when you link in A and B. You need to have a way to make these private. By default all symbols are exported. One way to do this is to have a special linker definition file for both A and B that explicitly mention which files need to be exported.
[1] ODR = One Definition Rule.
I think the best course of action here will be to ignore/disable the linker warnings(LNK4006) since C.lib needs to be part of both A.Lib and B.lib and A.Lib does not need to know that B.lib itself uses C.Lib.
This may not fix your link error, but it might help with your dependency tree issue.
What I do, is just use a #pragma to include a lib in the .cpp file that needs it. For example:
#pragma comment(lib:"wsock32")
Like I said, I'm not sure it would keep the symbols in that object file, I'd have to whip up an example to try it out.
Poor flodin seems frustrated that nobody will explain how to disable the linker warnings. Well, I've had a similar problem, and for years I have simply lived with the fact that several hundred warnings were displayed. Now, however, thanks to the info from Link /ignore, I figured out how to disable the linker warnings.
I'm using Visual Studio 2008. In Project -> Settings -> Configuration Properties -> Librarian -> Command Line -> Additional Options, I added "/ignore:4006" (without the quotes). Now my warnings are gone!

Resources